V4L/DVB (8881): gspca: After 'while (retry--) {...}', retry will be -1 but not 0.
authorLi Zefan <lizf@cn.fujitsu.com>
Tue, 2 Sep 2008 10:02:50 +0000 (07:02 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 4 Sep 2008 21:27:51 +0000 (18:27 -0300)
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/conex.c
drivers/media/video/gspca/spca561.c

index 8c91ffde95360333e39fdab5cfd25d4282689872..4d9f4cc255a9540fe13e1fb36806f36cd7af6f7e 100644 (file)
@@ -731,13 +731,13 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
        reg_w_val(gspca_dev, 0x0000, 0x00);
        /* wait for completion */
        retry = 50;
-       while (retry--) {
+       do {
                reg_r(gspca_dev, 0x0002, 1);
                                                        /* 0x07 until 0x00 */
                if (gspca_dev->usb_buf[0] == 0x00)
                        break;
                reg_w_val(gspca_dev, 0x0053, 0x00);
-       }
+       } while (--retry);
        if (retry == 0)
                PDEBUG(D_ERR, "Damned Errors sending jpeg Table");
        /* send the qtable now */
index 1c29c279a982e242cbffe7339ecce2d23fed2db9..cfbc9ebc5c5d8f6bb6518bc352a1c0a69afe530b 100644 (file)
@@ -223,11 +223,11 @@ static int i2c_read(struct gspca_dev *gspca_dev, __u16 reg, __u8 mode)
        reg_w_val(gspca_dev->dev, 0x8804, 0x92);
        reg_w_val(gspca_dev->dev, 0x8801, reg);
        reg_w_val(gspca_dev->dev, 0x8802, (mode | 0x01));
-       while (retry--) {
+       do {
                reg_r(gspca_dev, 0x8803, 1);
                if (!gspca_dev->usb_buf)
                        break;
-       }
+       } while (--retry);
        if (retry == 0)
                return -1;
        reg_r(gspca_dev, 0x8800, 1);