[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200923090519.361-3-himadrispandya@gmail.com>
Date: Wed, 23 Sep 2020 14:35:17 +0530
From: Himadri Pandya <himadrispandya@...il.com>
To: davem@...emloft.net, kuba@...nel.org, oneukum@...e.com,
pankaj.laxminarayan.bharadiya@...el.com, keescook@...omium.org,
yuehaibing@...wei.com, petkan@...leusys.com, ogiannou@...il.com
Cc: linux-usb@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-kernel-mentees@...ts.linuxfoundation.org,
gregkh@...uxfoundation.org,
Himadri Pandya <himadrispandya@...il.com>
Subject: [PATCH 2/4] net: sierra_net: use usb_control_msg_recv()
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@...il.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
Powered by blists - more mailing lists