lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201104064703.15123-11-himadrispandya@gmail.com>
Date:   Wed,  4 Nov 2020 12:16:58 +0530
From:   Himadri Pandya <himadrispandya@...il.com>
To:     johan@...nel.org, gregkh@...uxfoundation.org,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     linux-kernel-mentees@...ts.linuxfoundation.org,
        Himadri Pandya <himadrispandya@...il.com>
Subject: [PATCH 10/15] usb: serial: io_ti: use usb_control_msg_recv() and usb_control_msg_send()

The new usb_control_msg_recv() and usb_control_msg_send() nicely wraps
usb_control_msg() with proper error check. Hence use the wrappers
instead of calling usb_control_msg() directly

Signed-off-by: Himadri Pandya <himadrispandya@...il.com>
---
 drivers/usb/serial/io_ti.c | 28 ++++++++++------------------
 1 file changed, 10 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index c327d4cf7928..ab2370b80b3c 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -260,16 +260,12 @@ static int ti_vread_sync(struct usb_device *dev, __u8 request,
 {
 	int status;
 
-	status = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), request,
-			(USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN),
-			value, index, data, size, 1000);
-	if (status < 0)
+	status = usb_control_msg_recv(dev, 0, request, USB_TYPE_VENDOR |
+				      USB_RECIP_DEVICE | USB_DIR_IN, value,
+				      index, data, size, 1000, GFP_KERNEL);
+	if (status)
 		return status;
-	if (status != size) {
-		dev_dbg(&dev->dev, "%s - wanted to write %d, but only wrote %d\n",
-			__func__, size, status);
-		return -ECOMM;
-	}
+
 	return 0;
 }
 
@@ -278,16 +274,12 @@ static int ti_vsend_sync(struct usb_device *dev, u8 request, u16 value,
 {
 	int status;
 
-	status = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), request,
-			(USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT),
-			value, index, data, size, timeout);
-	if (status < 0)
+	status = usb_control_msg_send(dev, 0, request, USB_TYPE_VENDOR |
+				      USB_RECIP_DEVICE | USB_DIR_OUT, value,
+				      index, data, size, timeout, GFP_KERNEL);
+	if (status)
 		return status;
-	if (status != size) {
-		dev_dbg(&dev->dev, "%s - wanted to write %d, but only wrote %d\n",
-			__func__, size, status);
-		return -ECOMM;
-	}
+
 	return 0;
 }
 
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ