From: Alan Stern Date: Wed, 22 Aug 2007 17:06:53 +0000 (-0400) Subject: USB: fix mistake in usb_hcd_giveback_urb X-Git-Tag: v2.6.24-rc1~1395^2~66 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f5a3d0f34fd5719081c6b8f3dbbcbe328d4da31;p=linux-2.6 USB: fix mistake in usb_hcd_giveback_urb 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index ec17fc4d28..8b17babf5c 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -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; @@ -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);