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.ba...@linux.intel.com>
---
 drivers/usb/host/xhci.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 3b19444aa1f3..6be3eb721157 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -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.");
-- 
2.16.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to