Skip to content

Commit

Permalink
USB: fix mistake in usb_hcd_giveback_urb
Browse files Browse the repository at this point in the history
This patch (as971) fixes a small mistake: The URB's completion status
needs to be adjusted before the URB is passed to usmon_urb_complete(),
not afterward.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Oct 12, 2007
1 parent ed6e528 commit 1f5a3d0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/usb/core/hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1266,9 +1266,6 @@ int usb_hcd_unlink_urb (struct urb *urb, int status)
*/
void usb_hcd_giveback_urb (struct usb_hcd *hcd, struct urb *urb)
{
unmap_urb_for_dma(hcd, urb);
usbmon_urb_complete (&hcd->self, urb);
usb_unanchor_urb(urb);
urb->hcpriv = NULL;
if (unlikely(urb->unlinked))
urb->status = urb->unlinked;
Expand All @@ -1277,6 +1274,10 @@ void usb_hcd_giveback_urb (struct usb_hcd *hcd, struct urb *urb)
!urb->status))
urb->status = -EREMOTEIO;

unmap_urb_for_dma(hcd, urb);
usbmon_urb_complete(&hcd->self, urb);
usb_unanchor_urb(urb);

/* pass ownership to the completion handler */
urb->complete (urb);
atomic_dec (&urb->use_count);
Expand Down

0 comments on commit 1f5a3d0

Please sign in to comment.