[PATCH v3 25/70] dm: usb: Mark the device name as alloced when binding
Simon Glass
sjg at chromium.org
Tue Jan 17 18:47:35 CET 2023
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 <sjg at chromium.org>
---
(no changes since v1)
drivers/usb/host/usb-uclass.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index 93c318c3d1d..28f7ca9654d 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);
--
2.39.0.246.g2a6d74b583-goog
More information about the U-Boot
mailing list