Skip to content

Commit

Permalink
media: gspca: Check the return value of write_bridge for timeout
Browse files Browse the repository at this point in the history
In po1030_probe(), m5602_write_bridge() can timeout and return an error
value. The fix checks for the return value and propagates upstream
consistent with other usb drivers.

Signed-off-by: Aditya Pakki <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
Aditya Pakki authored and mchehab committed Jan 16, 2019
1 parent 5b71187 commit a21a0eb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/media/usb/gspca/m5602/m5602_po1030.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ static const struct v4l2_ctrl_config po1030_greenbal_cfg = {

int po1030_probe(struct sd *sd)
{
int rc = 0;
u8 dev_id_h = 0, i;
struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;

Expand All @@ -177,11 +178,14 @@ int po1030_probe(struct sd *sd)
for (i = 0; i < ARRAY_SIZE(preinit_po1030); i++) {
u8 data = preinit_po1030[i][2];
if (preinit_po1030[i][0] == SENSOR)
m5602_write_sensor(sd,
rc |= m5602_write_sensor(sd,
preinit_po1030[i][1], &data, 1);
else
m5602_write_bridge(sd, preinit_po1030[i][1], data);
rc |= m5602_write_bridge(sd, preinit_po1030[i][1],
data);
}
if (rc < 0)
return rc;

if (m5602_read_sensor(sd, PO1030_DEVID_H, &dev_id_h, 1))
return -ENODEV;
Expand Down

0 comments on commit a21a0eb

Please sign in to comment.