Skip to content

Commit

Permalink
usb: xhci: Return error when host is dead in xhci_disable_slot()
Browse files Browse the repository at this point in the history
xhci_disable_slot() is a helper for disabling a slot when a device
goes away or recovers from error situations. Currently, it returns
success when it sees a dead host. This is not the right way to go.
It should return error and let the invoker know that disable slot
command was failed due to a dead host.

Fixes: f9e609b ("usb: xhci: Add helper function xhci_disable_slot().")
Cc: Guoqing Zhang <[email protected]>
Signed-off-by: Lu Baolu <[email protected]>
Signed-off-by: Mathias Nyman <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
LuBaolu authored and gregkh committed Oct 5, 2017
1 parent 11ec758 commit dcabc76
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/usb/host/xhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -3582,10 +3582,9 @@ int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id)
state = readl(&xhci->op_regs->status);
if (state == 0xffffffff || (xhci->xhc_state & XHCI_STATE_DYING) ||
(xhci->xhc_state & XHCI_STATE_HALTED)) {
xhci_free_virt_device(xhci, slot_id);
spin_unlock_irqrestore(&xhci->lock, flags);
kfree(command);
return ret;
return -ENODEV;
}

ret = xhci_queue_slot_control(xhci, command, TRB_DISABLE_SLOT,
Expand Down

0 comments on commit dcabc76

Please sign in to comment.