Skip to content

Commit

Permalink
USB: core: drop pipe-type check from new control-message helpers
Browse files Browse the repository at this point in the history
The new control-message helpers include a pipe-type check which is
almost completely redundant.

Control messages are generally sent to the default pipe which always
exists and is of the correct type since its endpoint representation is
created by USB core as part of enumeration for all devices.

There is currently only one instance of a driver in the tree which use
a control endpoint other than endpoint 0 (and it does not use the new
helpers).

Drivers should be testing for the existence of their resources at probe
rather than at runtime, but to catch drivers failing to do so USB core
already does a sanity check on URB submission and triggers a WARN().
Having the same sanity check done in the helper only suppresses the
warning without allowing us to find and fix the drivers.

Signed-off-by: Johan Hovold <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
jhovold authored and gregkh committed Dec 7, 2020
1 parent 9383781 commit 7fe53dc
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions drivers/usb/core/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,6 @@ int usb_control_msg_send(struct usb_device *dev, __u8 endpoint, __u8 request,
int ret;
u8 *data = NULL;

if (usb_pipe_type_check(dev, pipe))
return -EINVAL;

if (size) {
data = kmemdup(driver_data, size, memflags);
if (!data)
Expand Down Expand Up @@ -272,7 +269,7 @@ int usb_control_msg_recv(struct usb_device *dev, __u8 endpoint, __u8 request,
int ret;
u8 *data;

if (!size || !driver_data || usb_pipe_type_check(dev, pipe))
if (!size || !driver_data)
return -EINVAL;

data = kmalloc(size, memflags);
Expand Down

0 comments on commit 7fe53dc

Please sign in to comment.