summaryrefslogtreecommitdiff
path: root/drivers/media/usb/stkwebcam/stk-webcam.c
diff options
context:
space:
mode:
authorAndreas Pape <ap@ca-pape.de>2018-11-23 19:14:54 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-13 10:52:28 +0300
commit8eccf35a6ff771f831587953dd5b3c659ad16e11 (patch)
tree4eee5774392e4552b7c7421f30483b2c88c29f96 /drivers/media/usb/stkwebcam/stk-webcam.c
parent50e9fda8654bf1c4a9239c253f99350b392842c1 (diff)
downloadlinux-8eccf35a6ff771f831587953dd5b3c659ad16e11.tar.xz
media: stkwebcam: Bugfix for wrong return values
[ Upstream commit 3c28b91380dd1183347d32d87d820818031ebecf ] usb_control_msg returns in case of a successfully sent message the number of sent bytes as a positive number. Don't use this value as a return value for stk_camera_read_reg, as a non-zero return value is used as an error condition in some cases when stk_camera_read_reg is called. Signed-off-by: Andreas Pape <ap@ca-pape.de> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/media/usb/stkwebcam/stk-webcam.c')
-rw-r--r--drivers/media/usb/stkwebcam/stk-webcam.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c
index 6e3f234e790b..e33fa78ef98d 100644
--- a/drivers/media/usb/stkwebcam/stk-webcam.c
+++ b/drivers/media/usb/stkwebcam/stk-webcam.c
@@ -164,7 +164,11 @@ int stk_camera_read_reg(struct stk_camera *dev, u16 index, u8 *value)
*value = *buf;
kfree(buf);
- return ret;
+
+ if (ret < 0)
+ return ret;
+ else
+ return 0;
}
static int stk_start_stream(struct stk_camera *dev)