Skip to contentSkip to conversation

patch "staging: vt6656: Fix non zero logical return of, usb_control_msg" added to staging-linus

PATCH [email protected] 1 participant 1 message Jan 3, 2020

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

staging: vt6656: Fix non zero logical return of, usb_control_msg

to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

From 58c3e681b04dd57c70d0dcb7b69fe52d043ff75a Mon Sep 17 00:00:00 2001
From: Malcolm Priestley <[email protected]>
Date: Fri, 20 Dec 2019 21:14:59 +0000
Subject: staging: vt6656: Fix non zero logical return of, usb_control_msg

Starting with commit 59608cb1de1856
("staging: vt6656: clean function's error path in usbpipe.c") the usb control functions have returned errors throughout driver with only logical variable checking.

However, usb_control_msg return the amount of bytes transferred this means that normal operation causes errors.

Correct the return function so only return zero when transfer is successful.

---
 drivers/staging/vt6656/usbpipe.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/staging/vt6656/usbpipe.c +6 -2
index d3304df6bd53..488ebd98773d 100644
@@ -59,7 +59,9 @@ int vnt_control_out(struct vnt_private *priv, u8 request, u16 value,
 
 	kfree(usb_buffer);
 
-	if (ret >= 0 && ret < (int)length)
+	if (ret == (int)length)
+		ret = 0;
+	else
 		ret = -EIO;
 
 end_unlock:
@@ -103,7 +105,9 @@ int vnt_control_in(struct vnt_private *priv, u8 request, u16 value,
 
 	kfree(usb_buffer);
 
-	if (ret >= 0 && ret < (int)length)
+	if (ret == (int)length)
+		ret = 0;
+	else
 		ret = -EIO;
 
 end_unlock:
Signature · 1 line
2.24.1