usb: core: usb_submit_urb: downgrade type check
PATCH 1/1 usb: core: usb_submit_urb: downgrade type check
Checking for the endpoint type is no reason for a WARN, as that can cause a reboot. A driver not checking the endpoint type must not cause a reboot, as there is just no point in this.
We cannot prevent a device from doing something incorrect as a reaction to a transfer. Hence warning for a mere assumption being wrong is not sensible.
--- drivers/usb/core/urb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/core/urb.c +1 -1
@@ -500,7 +500,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)/* Check that the pipe's type matches the endpoint's type */ if (usb_pipe_type_check (urb->dev, urb->pipe)) -dev_WARN (&dev->dev,"BOGUS urb xfer, pipe %x != type %x\n" , +dev_dbg (&dev->dev,"BOGUS urb xfer, pipe %x != type %x\n" ,usb_pipetype (urb->pipe), pipetypes[xfertype]);/* Check against a simple/standard policy */
Signature · 1 line
2.49.0
Quoted 7 lines · Oliver Neukum
Checking for the endpoint type is no reason for a WARN, as that can cause a reboot. A driver not checking the endpoint type must not cause a reboot, as there is just no point in this.
We cannot prevent a device from doing something incorrect as a reaction to a transfer. Hence warning for a mere assumption being wrong is not sensible.
Agreed. On the other hand, we (or at least, I) don't want these messages to get lost because people haven't enabled dynamic debugging. And even though we can't change the way the device behaves, we can alter the kernel's behavior.
How about using dev_warn_once() instead?
Alan Stern
Quoted 23 lines
Signed-off-by Oliver Neukum <[email protected]>--- drivers/usb/core/urb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/usb/core/urb.c +1
-1@@ -500,7 +500,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)/* Check that the pipe's type matches the endpoint's type */ if (usb_pipe_type_check (urb->dev, urb->pipe)) -dev_WARN (&dev->dev,"BOGUS urb xfer, pipe %x != type %x\n" , +dev_dbg (&dev->dev,"BOGUS urb xfer, pipe %x != type %x\n" ,usb_pipetype (urb->pipe), pipetypes[xfertype]);/* Check against a simple/standard policy */ Signature · 1 line
2.49.0