]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: legacy_hub_port_reset() check and propagate usb_set_port_feature() errors
authorHans de Goede <hdegoede@redhat.com>
Sun, 10 May 2015 12:10:15 +0000 (14:10 +0200)
committerSimon Glass <sjg@chromium.org>
Fri, 15 May 2015 00:49:30 +0000 (18:49 -0600)
Actually check for usb_set_port_feature() errors and propagate these if they
happen.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
common/usb_hub.c

index c9be530d0bfab29d87e042ce72d00d982bff55c1..7aac2201166300c2dab5a72a053c33ec408fab68 100644 (file)
@@ -157,7 +157,7 @@ static inline char *portspeed(int portstatus)
 int legacy_hub_port_reset(struct usb_device *dev, int port,
                        unsigned short *portstat)
 {
-       int tries;
+       int err, tries;
        ALLOC_CACHE_ALIGN_BUFFER(struct usb_port_status, portsts, 1);
        unsigned short portstatus, portchange;
 
@@ -168,8 +168,10 @@ int legacy_hub_port_reset(struct usb_device *dev, int port,
        debug("%s: resetting port %d...\n", __func__, port + 1);
 #endif
        for (tries = 0; tries < MAX_TRIES; tries++) {
+               err = usb_set_port_feature(dev, port + 1, USB_PORT_FEAT_RESET);
+               if (err < 0)
+                       return err;
 
-               usb_set_port_feature(dev, port + 1, USB_PORT_FEAT_RESET);
                mdelay(200);
 
                if (usb_get_port_status(dev, port + 1, portsts) < 0) {