summaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci.c
diff options
context:
space:
mode:
authorMathias Nyman <mathias.nyman@linux.intel.com>2016-11-11 15:13:12 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-11-14 10:18:21 +0100
commitc11ae038d62bf07231be7b813435e5067c978ddc (patch)
tree45509002a08622b466fad822c26a0e620505d61e /drivers/usb/host/xhci.c
parent99154fd3aa9ce49f0fb842f2b07f174ae7345b64 (diff)
downloadlinux-c11ae038d62bf07231be7b813435e5067c978ddc.tar.bz2
xhci: don't try to reset the host if it is unaccessible
There is no point in trying to reset the host controller by writing to its registers if host is removed and registers just return 0xffffffff bail out and return -ENODEV instead Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/xhci.c')
-rw-r--r--drivers/usb/host/xhci.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index b503189b98b0..641663f18fdb 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -167,6 +167,12 @@ int xhci_reset(struct xhci_hcd *xhci)
int ret, i;
state = readl(&xhci->op_regs->status);
+
+ if (state == ~(u32)0) {
+ xhci_warn(xhci, "Host not accessible, reset failed.\n");
+ return -ENODEV;
+ }
+
if ((state & STS_HALT) == 0) {
xhci_warn(xhci, "Host controller not halted, aborting reset.\n");
return 0;
@@ -690,7 +696,6 @@ void xhci_stop(struct usb_hcd *hcd)
xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;
xhci_halt(xhci);
xhci_reset(xhci);
-
spin_unlock_irq(&xhci->lock);
}