aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2014-07-18 16:25:49 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-18 19:30:46 -0400
commit8b3ab0edaf6acd281243bf974fac7e01c9574d08 (patch)
treef00e592e7f176b5dc5e2a088fb6f72618c1858e7
parent95d9a01d727fdb6d2b667ac374341c48777cc41e (diff)
USB: OHCI: no shortcut for unlinking URBS from a dead controller
When an URB is unlinked from a dead controller, ohci-hcd gives back the URB with no regard for cleaning up the internal data structures. This won't play nicely with the upcoming changes to the TD done list. Therefore make ohci_urb_dequeue() call finish_unlinks(), which uses td_done() to do a proper cleanup, rather than calling finish_urb() directly. Also, remove the checks that urb_priv is non-NULL; the driver guarantees that urb_priv will never be NULL for a valid URB. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/host/ohci-hcd.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index a8f0e1b00e7d..52829276a44e 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -300,30 +300,24 @@ static int ohci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
300 struct ohci_hcd *ohci = hcd_to_ohci (hcd); 300 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
301 unsigned long flags; 301 unsigned long flags;
302 int rc; 302 int rc;
303 urb_priv_t *urb_priv;
303 304
304 spin_lock_irqsave (&ohci->lock, flags); 305 spin_lock_irqsave (&ohci->lock, flags);
305 rc = usb_hcd_check_unlink_urb(hcd, urb, status); 306 rc = usb_hcd_check_unlink_urb(hcd, urb, status);
306 if (rc) { 307 if (rc == 0) {
307 ; /* Do nothing */
308 } else if (ohci->rh_state == OHCI_RH_RUNNING) {
309 urb_priv_t *urb_priv;
310 308
311 /* Unless an IRQ completed the unlink while it was being 309 /* Unless an IRQ completed the unlink while it was being
312 * handed to us, flag it for unlink and giveback, and force 310 * handed to us, flag it for unlink and giveback, and force
313 * some upcoming INTR_SF to call finish_unlinks() 311 * some upcoming INTR_SF to call finish_unlinks()
314 */ 312 */
315 urb_priv = urb->hcpriv; 313 urb_priv = urb->hcpriv;
316 if (urb_priv) { 314 if (urb_priv->ed->state == ED_OPER)
317 if (urb_priv->ed->state == ED_OPER) 315 start_ed_unlink(ohci, urb_priv->ed);
318 start_ed_unlink (ohci, urb_priv->ed); 316
317 if (ohci->rh_state != OHCI_RH_RUNNING) {
318 /* With HC dead, we can clean up right away */
319 finish_unlinks(ohci, 0);
319 } 320 }
320 } else {
321 /*
322 * with HC dead, we won't respect hc queue pointers
323 * any more ... just clean up every urb's memory.
324 */
325 if (urb->hcpriv)
326 finish_urb(ohci, urb, status);
327 } 321 }
328 spin_unlock_irqrestore (&ohci->lock, flags); 322 spin_unlock_irqrestore (&ohci->lock, flags);
329 return rc; 323 return rc;