From d96f80bd9bde58b317d3558ab23636b02b002786 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Wed, 7 Nov 2012 16:35:00 -0500 Subject: [PATCH] --- yaml --- r: 338654 b: refs/heads/master c: 2f02bc8af3abb846823811af65ec6cc46a4d525d h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/Documentation/usb/error-codes.txt | 2 ++ trunk/drivers/usb/core/urb.c | 7 ++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 0b7f31be810a..e46aaad1b441 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2656a9abcf1ec8dd5fee6a75d6997a0f2fa0094e +refs/heads/master: 2f02bc8af3abb846823811af65ec6cc46a4d525d diff --git a/trunk/Documentation/usb/error-codes.txt b/trunk/Documentation/usb/error-codes.txt index 8d1e2a9ebbba..9c3eb845ebe5 100644 --- a/trunk/Documentation/usb/error-codes.txt +++ b/trunk/Documentation/usb/error-codes.txt @@ -21,6 +21,8 @@ Non-USB-specific: USB-specific: +-EBUSY The URB is already active. + -ENODEV specified USB-device or bus doesn't exist -ENOENT specified interface or endpoint does not exist or diff --git a/trunk/drivers/usb/core/urb.c b/trunk/drivers/usb/core/urb.c index 3662287e2f4f..e0d9d948218c 100644 --- a/trunk/drivers/usb/core/urb.c +++ b/trunk/drivers/usb/core/urb.c @@ -321,8 +321,13 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) struct usb_host_endpoint *ep; int is_out; - if (!urb || urb->hcpriv || !urb->complete) + if (!urb || !urb->complete) return -EINVAL; + if (urb->hcpriv) { + WARN_ONCE(1, "URB %p submitted while active\n", urb); + return -EBUSY; + } + dev = urb->dev; if ((!dev) || (dev->state < USB_STATE_UNAUTHENTICATED)) return -ENODEV;