Skip to content

Commit b062fb0

Browse files
Malcolm Priestleygregkh
Malcolm Priestley
authored andcommitted
staging: vt6656: Fix non zero logical return of, usb_control_msg
commit 58c3e68 upstream. Starting with commit 59608cb ("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. Cc: stable <[email protected]> # v5.3+ Signed-off-by: Malcolm Priestley <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f2a6955 commit b062fb0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/staging/vt6656/usbpipe.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ int vnt_control_out(struct vnt_private *priv, u8 request, u16 value,
5959

6060
kfree(usb_buffer);
6161

62-
if (ret >= 0 && ret < (int)length)
62+
if (ret == (int)length)
63+
ret = 0;
64+
else
6365
ret = -EIO;
6466

6567
end_unlock:
@@ -103,7 +105,9 @@ int vnt_control_in(struct vnt_private *priv, u8 request, u16 value,
103105

104106
kfree(usb_buffer);
105107

106-
if (ret >= 0 && ret < (int)length)
108+
if (ret == (int)length)
109+
ret = 0;
110+
else
107111
ret = -EIO;
108112

109113
end_unlock:

0 commit comments

Comments
 (0)