diff options
Diffstat (limited to 'drivers/usb/host/ehci-q.c')
-rw-r--r-- | drivers/usb/host/ehci-q.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 5bb872c3496d..bf03ec0d8ee2 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
@@ -912,6 +912,7 @@ submit_async ( | |||
912 | int epnum; | 912 | int epnum; |
913 | unsigned long flags; | 913 | unsigned long flags; |
914 | struct ehci_qh *qh = NULL; | 914 | struct ehci_qh *qh = NULL; |
915 | int rc = 0; | ||
915 | 916 | ||
916 | qtd = list_entry (qtd_list->next, struct ehci_qtd, qtd_list); | 917 | qtd = list_entry (qtd_list->next, struct ehci_qtd, qtd_list); |
917 | epnum = ep->desc.bEndpointAddress; | 918 | epnum = ep->desc.bEndpointAddress; |
@@ -926,21 +927,28 @@ submit_async ( | |||
926 | #endif | 927 | #endif |
927 | 928 | ||
928 | spin_lock_irqsave (&ehci->lock, flags); | 929 | spin_lock_irqsave (&ehci->lock, flags); |
930 | if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, | ||
931 | &ehci_to_hcd(ehci)->flags))) { | ||
932 | rc = -ESHUTDOWN; | ||
933 | goto done; | ||
934 | } | ||
935 | |||
929 | qh = qh_append_tds (ehci, urb, qtd_list, epnum, &ep->hcpriv); | 936 | qh = qh_append_tds (ehci, urb, qtd_list, epnum, &ep->hcpriv); |
937 | if (unlikely(qh == NULL)) { | ||
938 | rc = -ENOMEM; | ||
939 | goto done; | ||
940 | } | ||
930 | 941 | ||
931 | /* Control/bulk operations through TTs don't need scheduling, | 942 | /* Control/bulk operations through TTs don't need scheduling, |
932 | * the HC and TT handle it when the TT has a buffer ready. | 943 | * the HC and TT handle it when the TT has a buffer ready. |
933 | */ | 944 | */ |
934 | if (likely (qh != NULL)) { | 945 | if (likely (qh->qh_state == QH_STATE_IDLE)) |
935 | if (likely (qh->qh_state == QH_STATE_IDLE)) | 946 | qh_link_async (ehci, qh_get (qh)); |
936 | qh_link_async (ehci, qh_get (qh)); | 947 | done: |
937 | } | ||
938 | spin_unlock_irqrestore (&ehci->lock, flags); | 948 | spin_unlock_irqrestore (&ehci->lock, flags); |
939 | if (unlikely (qh == NULL)) { | 949 | if (unlikely (qh == NULL)) |
940 | qtd_list_free (ehci, urb, qtd_list); | 950 | qtd_list_free (ehci, urb, qtd_list); |
941 | return -ENOMEM; | 951 | return rc; |
942 | } | ||
943 | return 0; | ||
944 | } | 952 | } |
945 | 953 | ||
946 | /*-------------------------------------------------------------------------*/ | 954 | /*-------------------------------------------------------------------------*/ |