diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 6fd20d69c508..257f1ea66d89 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -3611,8 +3611,6 @@ void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) int i, ret; struct xhci_command *command; - xhci_debugfs_remove_slot(xhci, udev->slot_id); - command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); if (!command) return; @@ -3646,6 +3644,8 @@ void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) del_timer_sync(&virt_dev->eps[i].stop_cmd_timer); } + xhci_debugfs_remove_slot(xhci, udev->slot_id); + spin_lock_irqsave(&xhci->lock, flags); virt_dev->udev = NULL;