usb: xhci: Return error when host is dead in xhci_disable_slot()
authorLu Baolu <baolu.lu@linux.intel.com>
Thu, 5 Oct 2017 08:21:43 +0000 (11:21 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Oct 2017 09:01:58 +0000 (11:01 +0200)
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: f9e609b82479 ("usb: xhci: Add helper function xhci_disable_slot().")
Cc: Guoqing Zhang <guoqing.zhang@intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci.c

index 23378f33142f16e2d9bc63e7483b524b085f4e11..cf10d7b5fd0a29be742da8fca49205b1c2470595 100644 (file)
@@ -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,