Commit 38679b72 authored by Arvid Brodin's avatar Arvid Brodin Committed by Greg Kroah-Hartman

usb/isp1760: Fix missing endpoint unlink when no mem during enqueue

... and some small code style fixes.
Signed-off-by: default avatarArvid Brodin <arvid.brodin@enea.com>
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 6d50c60e
...@@ -777,10 +777,7 @@ static void collect_qtds(struct usb_hcd *hcd, struct isp1760_qh *qh, ...@@ -777,10 +777,7 @@ static void collect_qtds(struct usb_hcd *hcd, struct isp1760_qh *qh,
if (qtd->status < QTD_XFER_COMPLETE) if (qtd->status < QTD_XFER_COMPLETE)
break; break;
if (list_is_last(&qtd->qtd_list, &qh->qtd_list)) last_qtd = last_qtd_of_urb(qtd, qh);
last_qtd = 1;
else
last_qtd = qtd->urb != qtd_next->urb;
if ((!last_qtd) && (qtd->status == QTD_RETIRE)) if ((!last_qtd) && (qtd->status == QTD_RETIRE))
qtd_next->status = QTD_RETIRE; qtd_next->status = QTD_RETIRE;
...@@ -821,7 +818,7 @@ static void collect_qtds(struct usb_hcd *hcd, struct isp1760_qh *qh, ...@@ -821,7 +818,7 @@ static void collect_qtds(struct usb_hcd *hcd, struct isp1760_qh *qh,
urb_listitem = kmem_cache_zalloc(urb_listitem_cachep, urb_listitem = kmem_cache_zalloc(urb_listitem_cachep,
GFP_ATOMIC); GFP_ATOMIC);
if (unlikely(!urb_listitem)) if (unlikely(!urb_listitem))
break; break; /* Try again on next call */
urb_listitem->urb = qtd->urb; urb_listitem->urb = qtd->urb;
list_add_tail(&urb_listitem->urb_list, urb_list); list_add_tail(&urb_listitem->urb_list, urb_list);
} }
...@@ -1543,7 +1540,6 @@ static int isp1760_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, ...@@ -1543,7 +1540,6 @@ static int isp1760_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
packetize_urb(hcd, urb, &new_qtds, mem_flags); packetize_urb(hcd, urb, &new_qtds, mem_flags);
if (list_empty(&new_qtds)) if (list_empty(&new_qtds))
return -ENOMEM; return -ENOMEM;
urb->hcpriv = NULL; /* Used to signal unlink to interrupt handler */
retval = 0; retval = 0;
spin_lock_irqsave(&priv->lock, spinflags); spin_lock_irqsave(&priv->lock, spinflags);
...@@ -1571,6 +1567,7 @@ static int isp1760_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, ...@@ -1571,6 +1567,7 @@ static int isp1760_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
qh = qh_alloc(GFP_ATOMIC); qh = qh_alloc(GFP_ATOMIC);
if (!qh) { if (!qh) {
retval = -ENOMEM; retval = -ENOMEM;
usb_hcd_unlink_urb_from_ep(hcd, urb);
goto out; goto out;
} }
list_add_tail(&qh->qh_list, ep_queue); list_add_tail(&qh->qh_list, ep_queue);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment