[PATCH 4/4] dm: core: free old name in device_set_name to prevent leak
Simon Glass
sjg at chromium.org
Thu Jul 9 21:14:22 CEST 2026
On 2026-07-03T09:11:23, Peng Fan <peng.fan at oss.nxp.com> wrote:
> dm: core: free old name in device_set_name to prevent leak
>
> If device_set_name is called on a device that already has
> DM_FLAG_NAME_ALLOCED set, the old dynamically-allocated name is leaked.
> Free it before assigning the new name.
>
> See: drivers/net/mdio_gpio.c:mdio_gpio_bind(). There is
> device_set_name() here, however dm_mdio_post_bind() will also call
> device_set_name() if 'device-name' exists.
>
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
>
> drivers/core/device.c | 2 ++
> 1 file changed, 2 insertions(+)
Reviewed-by: Simon Glass <sjg at chromium.org>
More information about the U-Boot
mailing list