[<prev] [next>] [day] [month] [year] [list]
Message-ID: <48BBB71E.7060400@cn.fujitsu.com>
Date: Mon, 01 Sep 2008 17:34:22 +0800
From: Li Zefan <lizf@...fujitsu.com>
To: Mauro Carvalho Chehab <mchehab@...radead.org>
CC: moinejf@...e.fr, LKML <linux-kernel@...r.kernel.org>,
video4linux-list@...hat.com
Subject: [PATCH] V4L/DVB: gspca: fix wrong retry counting
After 'while (retry--) {...}', retry will be -1 but not 0.
Signed-off-by: Li Zefan <lizf@...fujitsu.com>
---
drivers/media/video/gspca/conex.c | 4 ++--
drivers/media/video/gspca/spca561.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/media/video/gspca/conex.c b/drivers/media/video/gspca/conex.c
index cd3a3f5..b5e3e96 100644
--- a/drivers/media/video/gspca/conex.c
+++ b/drivers/media/video/gspca/conex.c
@@ -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 */
diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c
index 1073ac3..5ba3b75 100644
--- a/drivers/media/video/gspca/spca561.c
+++ b/drivers/media/video/gspca/spca561.c
@@ -231,11 +231,11 @@ static int i2c_read(struct gspca_dev *gspca_dev, __u16 reg, __u8 mode)
reg_w_val(gspca_dev->dev, 0x92, 0x8804);
reg_w_val(gspca_dev->dev, reg, 0x8801);
reg_w_val(gspca_dev->dev, (mode | 0x01), 0x8802);
- 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);
--
1.5.4.rc3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists