Skip to content

Commit dacb408

Browse files
committed
media: gspca: properly check for errors in po1030_probe()
If m5602_write_sensor() or m5602_write_bridge() fail, do not continue to initialize the device but return the error to the calling funtion. Cc: Mauro Carvalho Chehab <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8e23e83 commit dacb408

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

drivers/media/usb/gspca/m5602/m5602_po1030.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ static const struct v4l2_ctrl_config po1030_greenbal_cfg = {
155155
int po1030_probe(struct sd *sd)
156156
{
157157
u8 dev_id_h = 0, i;
158+
int err;
158159
struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
159160

160161
if (force_sensor) {
@@ -173,10 +174,13 @@ int po1030_probe(struct sd *sd)
173174
for (i = 0; i < ARRAY_SIZE(preinit_po1030); i++) {
174175
u8 data = preinit_po1030[i][2];
175176
if (preinit_po1030[i][0] == SENSOR)
176-
m5602_write_sensor(sd,
177-
preinit_po1030[i][1], &data, 1);
177+
err = m5602_write_sensor(sd, preinit_po1030[i][1],
178+
&data, 1);
178179
else
179-
m5602_write_bridge(sd, preinit_po1030[i][1], data);
180+
err = m5602_write_bridge(sd, preinit_po1030[i][1],
181+
data);
182+
if (err < 0)
183+
return err;
180184
}
181185

182186
if (m5602_read_sensor(sd, PO1030_DEVID_H, &dev_id_h, 1))

0 commit comments

Comments
 (0)