diff options
author | Arvid Brodin <arvid.brodin@enea.com> | 2011-08-21 02:29:27 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-08-22 18:32:45 -0400 |
commit | 38679b720014d89b192c38d4c604f5a718b9788d (patch) | |
tree | f5c8bd6b097e5442811440655de7062ffde421e1 /drivers | |
parent | 6d50c60e6d169b04b0cf0b267eb14ab0839f9540 (diff) |
usb/isp1760: Fix missing endpoint unlink when no mem during enqueue
... and some small code style fixes.
Signed-off-by: Arvid Brodin <arvid.brodin@enea.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/host/isp1760-hcd.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c index 14c9238a5017..1eb69e050941 100644 --- a/drivers/usb/host/isp1760-hcd.c +++ b/drivers/usb/host/isp1760-hcd.c | |||
@@ -777,10 +777,7 @@ static void collect_qtds(struct usb_hcd *hcd, struct isp1760_qh *qh, | |||
777 | if (qtd->status < QTD_XFER_COMPLETE) | 777 | if (qtd->status < QTD_XFER_COMPLETE) |
778 | break; | 778 | break; |
779 | 779 | ||
780 | if (list_is_last(&qtd->qtd_list, &qh->qtd_list)) | 780 | last_qtd = last_qtd_of_urb(qtd, qh); |
781 | last_qtd = 1; | ||
782 | else | ||
783 | last_qtd = qtd->urb != qtd_next->urb; | ||
784 | 781 | ||
785 | if ((!last_qtd) && (qtd->status == QTD_RETIRE)) | 782 | if ((!last_qtd) && (qtd->status == QTD_RETIRE)) |
786 | qtd_next->status = QTD_RETIRE; | 783 | qtd_next->status = QTD_RETIRE; |
@@ -821,7 +818,7 @@ static void collect_qtds(struct usb_hcd *hcd, struct isp1760_qh *qh, | |||
821 | urb_listitem = kmem_cache_zalloc(urb_listitem_cachep, | 818 | urb_listitem = kmem_cache_zalloc(urb_listitem_cachep, |
822 | GFP_ATOMIC); | 819 | GFP_ATOMIC); |
823 | if (unlikely(!urb_listitem)) | 820 | if (unlikely(!urb_listitem)) |
824 | break; | 821 | break; /* Try again on next call */ |
825 | urb_listitem->urb = qtd->urb; | 822 | urb_listitem->urb = qtd->urb; |
826 | list_add_tail(&urb_listitem->urb_list, urb_list); | 823 | list_add_tail(&urb_listitem->urb_list, urb_list); |
827 | } | 824 | } |
@@ -1543,7 +1540,6 @@ static int isp1760_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
1543 | packetize_urb(hcd, urb, &new_qtds, mem_flags); | 1540 | packetize_urb(hcd, urb, &new_qtds, mem_flags); |
1544 | if (list_empty(&new_qtds)) | 1541 | if (list_empty(&new_qtds)) |
1545 | return -ENOMEM; | 1542 | return -ENOMEM; |
1546 | urb->hcpriv = NULL; /* Used to signal unlink to interrupt handler */ | ||
1547 | 1543 | ||
1548 | retval = 0; | 1544 | retval = 0; |
1549 | spin_lock_irqsave(&priv->lock, spinflags); | 1545 | spin_lock_irqsave(&priv->lock, spinflags); |
@@ -1571,6 +1567,7 @@ static int isp1760_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
1571 | qh = qh_alloc(GFP_ATOMIC); | 1567 | qh = qh_alloc(GFP_ATOMIC); |
1572 | if (!qh) { | 1568 | if (!qh) { |
1573 | retval = -ENOMEM; | 1569 | retval = -ENOMEM; |
1570 | usb_hcd_unlink_urb_from_ep(hcd, urb); | ||
1574 | goto out; | 1571 | goto out; |
1575 | } | 1572 | } |
1576 | list_add_tail(&qh->qh_list, ep_queue); | 1573 | list_add_tail(&qh->qh_list, ep_queue); |