From: Simon Glass Date: Tue, 17 Jan 2023 17:47:35 +0000 (-0700) Subject: dm: usb: Mark the device name as alloced when binding X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=ecdf3ab01f66585d0cb630b3ec28981dd4e7adff;p=u-boot.git dm: usb: Mark the device name as alloced when binding Since usb_find_and_bind_driver() allocates the device name it should tell driver about that, to avoid memory leaks. Fix this. Signed-off-by: Simon Glass --- diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c index 93c318c3d1..28f7ca9654 100644 --- a/drivers/usb/host/usb-uclass.c +++ b/drivers/usb/host/usb-uclass.c @@ -563,6 +563,8 @@ static int usb_find_and_bind_driver(struct udevice *parent, if (!str) return -ENOMEM; ret = device_bind_driver(parent, "usb_dev_generic_drv", str, devp); + if (!ret) + device_set_name_alloced(*devp); error: debug("%s: No match found: %d\n", __func__, ret);