diff options
author | Malcolm Priestley <tvboxspy@gmail.com> | 2019-12-21 00:14:59 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-01-14 22:08:29 +0300 |
commit | b062fb0ca0aa5ddb195133164e6e135bb51a0c79 (patch) | |
tree | 90efb9f42856b483f9caa108f30e7ae10e15f0d3 | |
parent | f2a6955c9b74cf20f471ab8a33b2aa6d257af013 (diff) | |
download | linux-b062fb0ca0aa5ddb195133164e6e135bb51a0c79.tar.xz |
staging: vt6656: Fix non zero logical return of, usb_control_msg
commit 58c3e681b04dd57c70d0dcb7b69fe52d043ff75a upstream.
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.
Cc: stable <stable@vger.kernel.org> # v5.3+
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/08e88842-6f78-a2e3-a7a0-139fec960b2b@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/vt6656/usbpipe.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c index d3304df6bd53..488ebd98773d 100644 --- a/drivers/staging/vt6656/usbpipe.c +++ b/drivers/staging/vt6656/usbpipe.c @@ -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: |