usb: fix ->update_hub_device() vs hdev->maxchild
authorDan Williams <dan.j.williams@intel.com>
Thu, 5 Jun 2014 21:23:04 +0000 (14:23 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Jun 2014 23:44:57 +0000 (16:44 -0700)
Commit d8521afe3586 "usb: assign default peer ports for root hubs"
delayed marking a hub valid (set hdev->maxchild) until it had been fully
configured and to enable the publishing of valid hubs to be serialized
by usb_port_peer_mutex.

However, xhci_update_hub_device() in some cases depends on
hdev->maxchild already being set.  Do the minimal fix and move it after
the setting of hdev->maxchild.

Cc: Mathias Nyman <mathias.nyman@linux.intel.com>
Reported-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Tested-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/hub.c

index 879b66e13370b5fc80fda8709d12dbbb2bd7d788..ec6f05cbbae335589cd1b8e417307a9dd29ba054 100644 (file)
@@ -1526,18 +1526,6 @@ static int hub_configure(struct usb_hub *hub,
                dev_dbg(hub_dev, "%umA bus power budget for each child\n",
                                hub->mA_per_port);
 
-       /* Update the HCD's internal representation of this hub before khubd
-        * starts getting port status changes for devices under the hub.
-        */
-       if (hcd->driver->update_hub_device) {
-               ret = hcd->driver->update_hub_device(hcd, hdev,
-                               &hub->tt, GFP_KERNEL);
-               if (ret < 0) {
-                       message = "can't update HCD hub info";
-                       goto fail;
-               }
-       }
-
        ret = hub_hub_status(hub, &hubstatus, &hubchange);
        if (ret < 0) {
                message = "can't get hub status";
@@ -1593,6 +1581,18 @@ static int hub_configure(struct usb_hub *hub,
        if (ret < 0)
                goto fail;
 
+       /* Update the HCD's internal representation of this hub before khubd
+        * starts getting port status changes for devices under the hub.
+        */
+       if (hcd->driver->update_hub_device) {
+               ret = hcd->driver->update_hub_device(hcd, hdev,
+                               &hub->tt, GFP_KERNEL);
+               if (ret < 0) {
+                       message = "can't update HCD hub info";
+                       goto fail;
+               }
+       }
+
        usb_hub_adjust_deviceremovable(hdev, hub->descriptor);
 
        hub_activate(hub, HUB_INIT);