From: Himadri Pandya <himadrispandya@gmail.com>
To: davem@davemloft.net, kuba@kernel.org, oneukum@suse.com,
pankaj.laxminarayan.bharadiya@intel.com, keescook@chromium.org,
yuehaibing@huawei.com, petkan@nucleusys.com, ogiannou@gmail.com
Cc: netdev@vger.kernel.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-kernel-mentees@lists.linuxfoundation.org
Subject: [Linux-kernel-mentees] [PATCH 2/4] net: sierra_net: use usb_control_msg_recv()
Date: Wed, 23 Sep 2020 14:35:17 +0530 [thread overview]
Message-ID: <20200923090519.361-3-himadrispandya@gmail.com> (raw)
In-Reply-To: <20200923090519.361-1-himadrispandya@gmail.com>
The new usb api function usb_control_msg_recv() nicely wrapps
usb_control_msg() with proper error check. Hence use it instead of
directly calling usb_control_msg().
Signed-off-by: Himadri Pandya <himadrispandya@gmail.com>
---
drivers/net/usb/sierra_net.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c
index 0abd257b634c..f3a5f83cb256 100644
--- a/drivers/net/usb/sierra_net.c
+++ b/drivers/net/usb/sierra_net.c
@@ -478,16 +478,13 @@ static void sierra_net_kevent(struct work_struct *work)
return;
ifnum = priv->ifnum;
- len = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
- USB_CDC_GET_ENCAPSULATED_RESPONSE,
- USB_DIR_IN|USB_TYPE_CLASS|USB_RECIP_INTERFACE,
- 0, ifnum, buf, SIERRA_NET_USBCTL_BUF_LEN,
- USB_CTRL_SET_TIMEOUT);
-
- if (len < 0) {
- netdev_err(dev->net,
- "usb_control_msg failed, status %d\n", len);
- } else {
+ len = usb_control_msg_recv(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
+ USB_CDC_GET_ENCAPSULATED_RESPONSE,
+ USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
+ 0, ifnum, buf, SIERRA_NET_USBCTL_BUF_LEN,
+ USB_CTRL_SET_TIMEOUT);
+
+ if (len) {
struct hip_hdr hh;
dev_dbg(&dev->udev->dev, "%s: Received status message,"
--
2.17.1
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
next prev parent reply other threads:[~2020-09-23 9:06 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-23 9:05 [Linux-kernel-mentees] [PATCH 0/4] net: usb: avoid using usb_control_msg() directly Himadri Pandya
2020-09-23 9:05 ` [Linux-kernel-mentees] [PATCH 1/4] net: usbnet: use usb_control_msg_recv() and usb_control_msg_send() Himadri Pandya
2020-09-23 10:24 ` Greg KH
2020-09-23 14:08 ` Himadri Pandya
2020-09-23 9:05 ` Himadri Pandya [this message]
2020-09-23 9:05 ` [Linux-kernel-mentees] [PATCH 3/4] net: usb: rtl8150: " Himadri Pandya
2020-09-23 10:22 ` Oliver Neukum
2020-09-23 14:06 ` Himadri Pandya
2020-09-23 14:20 ` Oliver Neukum
2020-09-23 14:32 ` Himadri Pandya
2020-09-24 11:13 ` Oliver Neukum
2020-09-25 11:23 ` Himadri Pandya
2020-09-23 14:48 ` Petko Manolov
2020-09-24 11:09 ` Oliver Neukum
2020-09-24 15:40 ` Petko Manolov
2020-09-24 16:01 ` Greg KH
2020-09-23 9:05 ` [Linux-kernel-mentees] [PATCH 4/4] net: rndis_host: " Himadri Pandya
2020-09-23 10:22 ` Greg KH
2020-09-23 14:14 ` Himadri Pandya
2020-09-23 10:23 ` [Linux-kernel-mentees] [PATCH 0/4] net: usb: avoid using usb_control_msg() directly Greg KH
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=20200923090519.361-3-himadrispandya@gmail.com \
--to=himadrispandya@gmail.com \
--cc=davem@davemloft.net \
--cc=keescook@chromium.org \
--cc=kuba@kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=ogiannou@gmail.com \
--cc=oneukum@suse.com \
--cc=pankaj.laxminarayan.bharadiya@intel.com \
--cc=petkan@nucleusys.com \
--cc=yuehaibing@huawei.com \
/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).