[PATCH 3/3] [media] m5602_ov7660: return error at ov7660_init()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It used to be a code that returns arror at ov7660_init.
However, this was removed by changeset c84e412f:

@@ -231,33 +116,40 @@ int ov7660_init(struct sd *sd)
        if (dump_sensor)
                ov7660_dump_registers(sd);

-   err = ov7660_set_gain(&sd->gspca_dev, sensor_settings[GAIN_IDX]);
-   if (err < 0)
-           return err;
+ return 0;
+}

-   err = ov7660_set_auto_white_balance(&sd->gspca_dev,
-           sensor_settings[AUTO_WHITE_BALANCE_IDX]);
-   if (err < 0)
-           return err;

As complained by gcc:
	drivers/media/usb/gspca/m5602/m5602_ov7660.c: In function 'ov7660_init':
	drivers/media/usb/gspca/m5602/m5602_ov7660.c:99:9: warning: variable 'err' set but not used [-Wunused-but-set-variable]

It should be noticed that the original error code was crappy, as it wasn't
returning any error if sensor init fails.

Fix it by returning an error if the sensor can't be initialized.

Cc: Hans de Goede <hdegoede@xxxxxxxxxx>
Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
---
 drivers/media/usb/gspca/m5602/m5602_ov7660.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/gspca/m5602/m5602_ov7660.c b/drivers/media/usb/gspca/m5602/m5602_ov7660.c
index 4ac7889..64b3b03 100644
--- a/drivers/media/usb/gspca/m5602/m5602_ov7660.c
+++ b/drivers/media/usb/gspca/m5602/m5602_ov7660.c
@@ -96,7 +96,7 @@ sensor_found:
 
 int ov7660_init(struct sd *sd)
 {
-	int i, err = 0;
+	int i, err;
 
 	/* Init the sensor */
 	for (i = 0; i < ARRAY_SIZE(init_ov7660); i++) {
@@ -111,6 +111,8 @@ int ov7660_init(struct sd *sd)
 			err = m5602_write_sensor(sd,
 				init_ov7660[i][1], data, 1);
 		}
+		if (err < 0)
+			return err;
 	}
 
 	if (dump_sensor)
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux