From: Johan Hovold <johan@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org,
Himadri Pandya <himadrispandya@gmail.com>,
Johan Hovold <johan@kernel.org>
Subject: [PATCH 1/3] USB: core: drop pipe-type check from new control-message helpers
Date: Fri, 4 Dec 2020 09:51:08 +0100 [thread overview]
Message-ID: <20201204085110.20055-2-johan@kernel.org> (raw)
In-Reply-To: <20201204085110.20055-1-johan@kernel.org>
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 <johan@kernel.org>
---
drivers/usb/core/message.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index c4e876050074..a04b01247117 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -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)
@@ -273,7 +270,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);
--
2.26.2
next prev parent reply other threads:[~2020-12-04 8:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-04 8:51 [PATCH 0/3] USB: tweak the new control-message helpers Johan Hovold
2020-12-04 8:51 ` Johan Hovold [this message]
2020-12-04 15:14 ` [PATCH 1/3] USB: core: drop pipe-type check from " Greg Kroah-Hartman
2020-12-04 15:50 ` Johan Hovold
2020-12-06 11:20 ` Greg Kroah-Hartman
2020-12-06 16:25 ` Alan Stern
2020-12-07 9:46 ` Johan Hovold
2020-12-07 14:24 ` Greg Kroah-Hartman
2020-12-04 8:51 ` [PATCH 2/3] USB: core: drop short-transfer check from usb_control_msg_send() Johan Hovold
2020-12-04 15:17 ` Greg Kroah-Hartman
2020-12-04 8:51 ` [PATCH 3/3] USB: core: return -EREMOTEIO on short usb_control_msg_recv() Johan Hovold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201204085110.20055-2-johan@kernel.org \
--to=johan@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=himadrispandya@gmail.com \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).