summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2015-05-10 14:10:15 +0200
committerSimon Glass <sjg@chromium.org>2015-05-14 18:49:30 -0600
commitad84a42fc5143ef66a75550d7465b86cbc787f25 (patch)
treedbfdb61a7d916aa475f3eae6be62eb157b52e701
parent651d95c8eb987034c95f1966556fbc55727a87b3 (diff)
usb: legacy_hub_port_reset() check and propagate usb_set_port_feature() errors
Actually check for usb_set_port_feature() errors and propagate these if they happen. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--common/usb_hub.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/usb_hub.c b/common/usb_hub.c
index c9be530d0b..7aac220116 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -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) {