Merge tag 'usb-for-v5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb...
[linux-2.6-microblaze.git] / drivers / usb / core / hub.c
index 5e8f3fa..2f94568 100644 (file)
@@ -3669,7 +3669,6 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
        struct usb_hub          *hub = usb_get_intfdata(intf);
        struct usb_device       *hdev = hub->hdev;
        unsigned                port1;
-       int                     status;
 
        /*
         * Warn if children aren't already suspended.
@@ -3703,12 +3702,12 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
        if (hub_is_superspeed(hdev) && hdev->do_remote_wakeup) {
                /* Enable hub to send remote wakeup for all ports. */
                for (port1 = 1; port1 <= hdev->maxchild; port1++) {
-                       status = set_port_feature(hdev,
-                                       port1 |
-                                       USB_PORT_FEAT_REMOTE_WAKE_CONNECT |
-                                       USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT |
-                                       USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT,
-                                       USB_PORT_FEAT_REMOTE_WAKE_MASK);
+                       set_port_feature(hdev,
+                                        port1 |
+                                        USB_PORT_FEAT_REMOTE_WAKE_CONNECT |
+                                        USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT |
+                                        USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT,
+                                        USB_PORT_FEAT_REMOTE_WAKE_MASK);
                }
        }
 
@@ -5903,7 +5902,10 @@ int usb_reset_device(struct usb_device *udev)
                                        cintf->needs_binding = 1;
                        }
                }
-               usb_unbind_and_rebind_marked_interfaces(udev);
+
+               /* If the reset failed, hub_wq will unbind drivers later */
+               if (ret == 0)
+                       usb_unbind_and_rebind_marked_interfaces(udev);
        }
 
        usb_autosuspend_device(udev);