Commit daa4e722 authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[PATCH] USB: usb_hcd_unlink_urb() test for list membership

This is a minor cleanup that replaces a test for non-null urb->hcpriv
with "is the urb on this list".  HCDs don't need to use hcpriv in that
way, and in general this is a safer way to test that.  (AIO does much
the same thing in its kiocb cancelation paths.)
parent f6470813
......@@ -1165,6 +1165,7 @@ static int hcd_unlink_urb (struct urb *urb)
struct device *sys = 0;
unsigned long flags;
struct completion_splice splice;
struct list_head *tmp;
int retval;
if (!urb)
......@@ -1203,7 +1204,12 @@ static int hcd_unlink_urb (struct urb *urb)
*/
WARN_ON (!HCD_IS_RUNNING (hcd->state) && hcd->state != USB_STATE_HALT);
if (!urb->hcpriv) {
/* insist the urb is still queued */
list_for_each(tmp, &dev->urb_list) {
if (tmp == &urb->urb_list)
break;
}
if (tmp != &urb->urb_list) {
retval = -EINVAL;
goto done;
}
......
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