From: Li Zefan <lizf@cn.fujitsu.com>
To: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: moinejf@free.fr, LKML <linux-kernel@vger.kernel.org>,
video4linux-list@redhat.com
Subject: [PATCH] V4L/DVB: gspca: fix wrong retry counting
Date: Mon, 01 Sep 2008 17:34:22 +0800 [thread overview]
Message-ID: <48BBB71E.7060400@cn.fujitsu.com> (raw)
After 'while (retry--) {...}', retry will be -1 but not 0.
Signed-off-by: Li Zefan <lizf@cn.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
reply other threads:[~2008-09-01 9:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48BBB71E.7060400@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@infradead.org \
--cc=moinejf@free.fr \
--cc=video4linux-list@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox