ChangeSet 1.1504.2.30, 2003/12/09 18:05:06-08:00, david-b@pacbell.net [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.) drivers/usb/core/hcd.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletion(-) diff -Nru a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c --- a/drivers/usb/core/hcd.c Mon Dec 29 14:23:39 2003 +++ b/drivers/usb/core/hcd.c Mon Dec 29 14:23:39 2003 @@ -1165,6 +1165,7 @@ struct device *sys = 0; unsigned long flags; struct completion_splice splice; + struct list_head *tmp; int retval; if (!urb) @@ -1203,7 +1204,12 @@ */ 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; }