V4L/DVB: gspca - sq930x: Check the USB read errors
authorJean-François Moine <moinejf@free.fr>
Thu, 24 Jun 2010 07:57:12 +0000 (04:57 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 2 Aug 2010 17:51:45 +0000 (14:51 -0300)
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/sq930x.c

index 7e4381bbaf289bf5bbf4569dc0f077c2c045ad11..dd24127d516822665b2754b0eb7911a259264a4c 100644 (file)
@@ -356,12 +356,20 @@ static const struct cap_s {
 static void reg_r(struct gspca_dev *gspca_dev,
                u16 value, int len)
 {
-       usb_control_msg(gspca_dev->dev,
+       int ret;
+
+       if (gspca_dev->usb_err < 0)
+               return;
+       ret = usb_control_msg(gspca_dev->dev,
                        usb_rcvctrlpipe(gspca_dev->dev, 0),
                        0x0c,
                        USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
                        value, 0, gspca_dev->usb_buf, len,
                        500);
+       if (ret < 0) {
+               PDEBUG(D_ERR, "reg_r %04x failed %d", value, ret);
+               gspca_dev->usb_err = ret;
+       }
 }
 
 static void reg_w(struct gspca_dev *gspca_dev, u16 value, u16 index)