CHROMIUM: xhci: fix hung task timeout when rm xhci-hcd
[firefly-linux-kernel-4.4.55.git] / drivers / usb / host / xhci.c
index e6ed6b2eab8ee2e4f4d9da95d1acc564cbad60ab..c4e2b1886f5d6688aee581562276f1f4e3793493 100644 (file)
@@ -1558,7 +1558,8 @@ int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
        if (ret || !urb->hcpriv)
                goto done;
        temp = readl(&xhci->op_regs->status);
-       if (temp == 0xffffffff || (xhci->xhc_state & XHCI_STATE_HALTED)) {
+       if (temp == 0xffffffff || (xhci->xhc_state & XHCI_STATE_HALTED) ||
+           (xhci->xhc_state & XHCI_STATE_REMOVING)) {
                xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,
                                "HW died, freeing TD.");
                urb_priv = urb->hcpriv;
@@ -3661,7 +3662,8 @@ void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
        /* Don't disable the slot if the host controller is dead. */
        state = readl(&xhci->op_regs->status);
        if (state == 0xffffffff || (xhci->xhc_state & XHCI_STATE_DYING) ||
-                       (xhci->xhc_state & XHCI_STATE_HALTED)) {
+                       (xhci->xhc_state & XHCI_STATE_HALTED) ||
+                       (xhci->xhc_state & XHCI_STATE_REMOVING)) {
                xhci_free_virt_device(xhci, udev->slot_id);
                spin_unlock_irqrestore(&xhci->lock, flags);
                kfree(command);