]> git.baikalelectronics.ru Git - uboot.git/commitdiff
dm: usb: Mark the device name as alloced when binding
authorSimon Glass <sjg@chromium.org>
Tue, 17 Jan 2023 17:47:35 +0000 (10:47 -0700)
committerTom Rini <trini@konsulko.com>
Mon, 23 Jan 2023 23:11:40 +0000 (18:11 -0500)
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

index 93c318c3d1d52a0e1ebbd08402c457665fca1d8f..28f7ca9654db2dd1c9e05d50d44b25f1ebf7ba19 100644 (file)
@@ -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);