/* If @urb was unlinked, the value of @status will be overridden by @urb->unlinked. Erroneous short transfers are detected in case the HCD hasn't checked for them.  */
void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, int status)
/* If @urb was unlinked, the value of @status will be overridden by @urb->unlinked. Erroneous short transfers are detected in case the HCD hasn't checked for them.  */
void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, int status)
{
	urb->hcpriv = NULL;
	if (unlikely(urb->unlinked))
		status = urb->unlinked;
	else if (unlikely((urb->transfer_flags & URB_SHORT_NOT_OK) &&
			urb->actual_length < urb->transfer_buffer_length &&
			!status))
		status = -EREMOTEIO;
	unmap_urb_for_dma(hcd, urb);
	usbmon_urb_complete(&hcd->self, urb, status);
	usb_unanchor_urb(urb);
	urb->status = status;
	urb->complete (urb);
	atomic_dec (&urb->use_count);
	if (unlikely(atomic_read(&urb->reject)))
		wake_up (&usb_kill_urb_queue);
	usb_put_urb (urb);
}