Smatch says:
drivers/usb/core/hub.c:4324 hub_port_init() warn: possible memory leak of 'buf'

Fixes: 1e6ed41e7e29 ("usb: xhci: change enumeration scheme to 'new scheme' by 
default")
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
---
 drivers/usb/core/hub.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 98a8af51d8a4..704f164b37d6 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4137,6 +4137,10 @@ hub_port_init (struct usb_hub *hub, struct usb_device 
*udev, int port1,
                        int r = 0;
 
                        did_new_scheme = true;
+                       retval = hub_enable_device(udev);
+                       if (retval < 0)
+                               goto fail;
+
 #define GET_DESCRIPTOR_BUFSIZE 64
                        buf = kmalloc(GET_DESCRIPTOR_BUFSIZE, GFP_NOIO);
                        if (!buf) {
@@ -4144,10 +4148,6 @@ hub_port_init (struct usb_hub *hub, struct usb_device 
*udev, int port1,
                                continue;
                        }
 
-                       retval = hub_enable_device(udev);
-                       if (retval < 0)
-                               goto fail;
-
                        /* Retry on all errors; some devices are flakey.
                         * 255 is for WUSB devices, we actually need to use
                         * 512 (WUSB1.0[4.8.1]).

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to