diff mbox series

[26/71] dm: usb: Mark the device name as alloced when binding

Message ID 20221207085137.445249-27-sjg@chromium.org
State Superseded
Delegated to: Tom Rini
Headers show
Series bootstd: Allow migration from distro_bootcmd scripts | expand

Commit Message

Simon Glass Dec. 7, 2022, 8:50 a.m. UTC
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@chromium.org>
---

 drivers/usb/host/usb-uclass.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index 956e2a4e8e4..04256eff879 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -559,6 +559,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);