diff options
-rw-r--r-- | drivers/usb/host/xhci-hub.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 1adae9eab831..364f60275043 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -398,14 +398,21 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend) | |||
398 | spin_lock_irqsave(&xhci->lock, flags); | 398 | spin_lock_irqsave(&xhci->lock, flags); |
399 | for (i = LAST_EP_INDEX; i > 0; i--) { | 399 | for (i = LAST_EP_INDEX; i > 0; i--) { |
400 | if (virt_dev->eps[i].ring && virt_dev->eps[i].ring->dequeue) { | 400 | if (virt_dev->eps[i].ring && virt_dev->eps[i].ring->dequeue) { |
401 | struct xhci_ep_ctx *ep_ctx; | ||
401 | struct xhci_command *command; | 402 | struct xhci_command *command; |
403 | |||
404 | ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->out_ctx, i); | ||
405 | |||
406 | /* Check ep is running, required by AMD SNPS 3.1 xHC */ | ||
407 | if (GET_EP_CTX_STATE(ep_ctx) != EP_STATE_RUNNING) | ||
408 | continue; | ||
409 | |||
402 | command = xhci_alloc_command(xhci, false, false, | 410 | command = xhci_alloc_command(xhci, false, false, |
403 | GFP_NOWAIT); | 411 | GFP_NOWAIT); |
404 | if (!command) { | 412 | if (!command) { |
405 | spin_unlock_irqrestore(&xhci->lock, flags); | 413 | spin_unlock_irqrestore(&xhci->lock, flags); |
406 | xhci_free_command(xhci, cmd); | 414 | xhci_free_command(xhci, cmd); |
407 | return -ENOMEM; | 415 | return -ENOMEM; |
408 | |||
409 | } | 416 | } |
410 | xhci_queue_stop_endpoint(xhci, command, slot_id, i, | 417 | xhci_queue_stop_endpoint(xhci, command, slot_id, i, |
411 | suspend); | 418 | suspend); |