Commit 8b8132bc authored by Sarah Sharp's avatar Sarah Sharp

USB: Ignore xHCI Reset Device status.

When the USB core finishes reseting a USB device, the xHCI driver sends
a Reset Device command to the host.  The xHC then updates its internal
representation of the USB device to the 'Default' device state.  If the
device was already in the Default state, the xHC will complete the
command with an error status.

If a device needs to be reset several times during enumeration, the
second reset will always fail because of the xHCI Reset Device command.
This can cause issues during enumeration.

For example, usb_reset_and_verify_device calls into hub_port_init in a
loop.  Say that on the first call into hub_port_init, the device is
successfully reset, but doesn't respond to several set address control
transfers.  Then the port will be disabled, but the udev will remain in
tact.  usb_reset_and_verify_device will call into hub_port_init again.

On the second call into hub_port_init, the device will be reset, and the
xHCI driver will issue a Reset Device command.  This command will fail
(because the device is already in the Default state), and
usb_reset_and_verify_device will fail.  The port will be disabled, and
the device won't be able to enumerate.

Fix this by ignoring the return value of the HCD reset_device callback.

This commit should be backported to kernels as old as 3.2, that contain
the commit 75d7cf72 "usbcore: refine
warm reset logic".
Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Cc: stable@vger.kernel.org
parent 1c7439c6
...@@ -2565,14 +2565,11 @@ static void hub_port_finish_reset(struct usb_hub *hub, int port1, ...@@ -2565,14 +2565,11 @@ static void hub_port_finish_reset(struct usb_hub *hub, int port1,
msleep(10 + 40); msleep(10 + 40);
update_devnum(udev, 0); update_devnum(udev, 0);
hcd = bus_to_hcd(udev->bus); hcd = bus_to_hcd(udev->bus);
if (hcd->driver->reset_device) { /* The xHC may think the device is already reset,
*status = hcd->driver->reset_device(hcd, udev); * so ignore the status.
if (*status < 0) { */
dev_err(&udev->dev, "Cannot reset " if (hcd->driver->reset_device)
"HCD device state\n"); hcd->driver->reset_device(hcd, udev);
break;
}
}
} }
/* FALL THROUGH */ /* FALL THROUGH */
case -ENOTCONN: case -ENOTCONN:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment