Commit c11ae038 authored by Mathias Nyman's avatar Mathias Nyman Committed by Greg Kroah-Hartman

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: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 99154fd3
...@@ -167,6 +167,12 @@ int xhci_reset(struct xhci_hcd *xhci) ...@@ -167,6 +167,12 @@ int xhci_reset(struct xhci_hcd *xhci)
int ret, i; int ret, i;
state = readl(&xhci->op_regs->status); 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) { if ((state & STS_HALT) == 0) {
xhci_warn(xhci, "Host controller not halted, aborting reset.\n"); xhci_warn(xhci, "Host controller not halted, aborting reset.\n");
return 0; return 0;
...@@ -690,7 +696,6 @@ void xhci_stop(struct usb_hcd *hcd) ...@@ -690,7 +696,6 @@ void xhci_stop(struct usb_hcd *hcd)
xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;
xhci_halt(xhci); xhci_halt(xhci);
xhci_reset(xhci); xhci_reset(xhci);
spin_unlock_irq(&xhci->lock); spin_unlock_irq(&xhci->lock);
} }
......
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