@@ -1444,6 +1444,13 @@ static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
if (ret)
goto done;
+ /* If xHC is dead take it down and return ALL URBs in xhci_hc_died() */
+ temp = readl(&xhci->op_regs->status);
+ if (temp == ~(u32)0 || xhci->xhc_state & XHCI_STATE_DYING) {
+ xhci_hc_died(xhci);
+ goto done;
+ }
+
/* give back URB now if we can't queue it for cancel */
vdev = xhci->devs[urb->dev->slot_id];
urb_priv = urb->hcpriv;
@@ -1456,13 +1463,6 @@ static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
if (!ep || !ep_ring)
goto err_giveback;
- /* If xHC is dead take it down and return ALL URBs in xhci_hc_died() */
- temp = readl(&xhci->op_regs->status);
- if (temp == ~(u32)0 || xhci->xhc_state & XHCI_STATE_DYING) {
- xhci_hc_died(xhci);
- goto done;
- }
-
if (xhci->xhc_state & XHCI_STATE_HALTED) {
xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,
"HC halted, freeing TD manually.");
in case where xHCI dies, we can bail out a little earlier. Not really a functional change, just making the code follow a more straight-forward order. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com> --- drivers/usb/host/xhci.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)