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 <s...@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 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);
-- 
2.39.0.314.g84b9a713c41-goog

Reply via email to