]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: gspca: Add error handling for stv06xx_read_sensor()
authorWentao Liang <vulab@iscas.ac.cn>
Tue, 22 Apr 2025 03:07:39 +0000 (11:07 +0800)
committerHans Verkuil <hverkuil@xs4all.nl>
Fri, 25 Apr 2025 13:14:37 +0000 (15:14 +0200)
In hdcs_init(), the return value of stv06xx_read_sensor() needs to be
checked. A proper implementation can be found in vv6410_dump(). Add a
check in loop condition and propergate error code to fix this issue.

Fixes: 4c98834addfe ("V4L/DVB (10048): gspca - stv06xx: New subdriver.")
Cc: stable@vger.kernel.org # v2.6+
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/usb/gspca/stv06xx/stv06xx_hdcs.c

index 5a47dcbf1c8e55650fc6bc3fa826ce10baac415d..303b055fefea986736865d102219421a601dc312 100644 (file)
@@ -520,12 +520,13 @@ static int hdcs_init(struct sd *sd)
 static int hdcs_dump(struct sd *sd)
 {
        u16 reg, val;
+       int err = 0;
 
        pr_info("Dumping sensor registers:\n");
 
-       for (reg = HDCS_IDENT; reg <= HDCS_ROWEXPH; reg++) {
-               stv06xx_read_sensor(sd, reg, &val);
+       for (reg = HDCS_IDENT; reg <= HDCS_ROWEXPH && !err; reg++) {
+               err = stv06xx_read_sensor(sd, reg, &val);
                pr_info("reg 0x%02x = 0x%02x\n", reg, val);
        }
-       return 0;
+       return (err < 0) ? err : 0;
 }