From 34bd644139b2cdc614413230641824f2ebd8960e Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Thu, 2 Feb 2012 15:38:14 -0500 Subject: [PATCH] --- yaml --- r: 289423 b: refs/heads/master c: 0cb54a3e47cb4baf0bc7463f0a64cfeae5e35697 h: refs/heads/master i: 289421: c47772b3703875565ca53a41dbb2ceca796deeae 289419: 53537bf85cabe2197c13d94a8633198426f4bd33 289415: 5bd18f19fdc801ee7f2acdf898b362d1204a7eb0 289407: 66dd28ddad0ad1c835b1dbea663ea57c7d9fa361 v: v3 --- [refs] | 2 +- trunk/drivers/usb/core/urb.c | 21 ++++++++------------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/[refs] b/[refs] index 3d8833c9eaa6..46e5cfb6d457 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c39c654fa2a830e1f73a2c118bf0c59ee18f3248 +refs/heads/master: 0cb54a3e47cb4baf0bc7463f0a64cfeae5e35697 diff --git a/trunk/drivers/usb/core/urb.c b/trunk/drivers/usb/core/urb.c index 909625b91eb3..f4f20c7b7765 100644 --- a/trunk/drivers/usb/core/urb.c +++ b/trunk/drivers/usb/core/urb.c @@ -403,20 +403,17 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) * cause problems in HCDs if they get it wrong. */ { - unsigned int orig_flags = urb->transfer_flags; unsigned int allowed; static int pipetypes[4] = { PIPE_CONTROL, PIPE_ISOCHRONOUS, PIPE_BULK, PIPE_INTERRUPT }; /* Check that the pipe's type matches the endpoint's type */ - if (usb_pipetype(urb->pipe) != pipetypes[xfertype]) { - dev_err(&dev->dev, "BOGUS urb xfer, pipe %x != type %x\n", + if (usb_pipetype(urb->pipe) != pipetypes[xfertype]) + dev_WARN(&dev->dev, "BOGUS urb xfer, pipe %x != type %x\n", usb_pipetype(urb->pipe), pipetypes[xfertype]); - return -EPIPE; /* The most suitable error code :-) */ - } - /* enforce simple/standard policy */ + /* Check against a simple/standard policy */ allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT | URB_DIR_MASK | URB_FREE_BUFFER); switch (xfertype) { @@ -435,14 +432,12 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) allowed |= URB_ISO_ASAP; break; } - urb->transfer_flags &= allowed; + allowed &= urb->transfer_flags; - /* fail if submitter gave bogus flags */ - if (urb->transfer_flags != orig_flags) { - dev_err(&dev->dev, "BOGUS urb flags, %x --> %x\n", - orig_flags, urb->transfer_flags); - return -EINVAL; - } + /* warn if submitter gave bogus flags */ + if (allowed != urb->transfer_flags) + dev_WARN(&dev->dev, "BOGUS urb flags, %x --> %x\n", + urb->transfer_flags, allowed); } #endif /*