From: Roel Kluin <roel.kluin@gmail.com>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: kalle.valo@nokia.com, linux-wireless@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] wl12xx: loop off by one.
Date: Thu, 16 Jul 2009 12:36:57 +0200 [thread overview]
Message-ID: <4A5F02C9.50505@gmail.com> (raw)
In-Reply-To: <4A524E91.9040400@gmail.com>
With `while (loop++ < INIT_LOOP)' `loop' becomes INIT_LOOP + 1 after
the loop.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
>> with `while (loop++ < INIT_LOOP)' `loop' reaches -1 after the loop.
>
> Sorry, my brains are on vacation mode right now and I can't understand
> how loop can reach -1.
The confusion is my fault. The changelog should have as above. The patch
is correct though.
> Here's the code:
> loop = 0;
> while (loop++ < INIT_LOOP) {
> ...
> }
>
> if (loop >= INIT_LOOP) {
> wl1251_error("timeout waiting for the hardware to "
> "complete initialization");
> return -EIO;
> }
In the last iteration `loop' is `INIT_LOOP -1', the test occurs and then
the increment to `INIT_LOOP'. If just then the break occurs:
`if (interrupt & wl->chip.intr_init_complete)' evaluates to true, then
we error out, although there was no timeout. This could be very unlikely
to occur.
> Also the patch won't apply to wireless-testing because main.c is renamed
> to wl1251_main.c.
Ok, this is against your tree
diff --git a/drivers/net/wireless/wl12xx/wl1251_boot.c b/drivers/net/wireless/wl12xx/wl1251_boot.c
index d8a155d..b2ae71c 100644
--- a/drivers/net/wireless/wl12xx/wl1251_boot.c
+++ b/drivers/net/wireless/wl12xx/wl1251_boot.c
@@ -247,7 +247,7 @@ int wl1251_boot_run_firmware(struct wl1251 *wl)
}
}
- if (loop >= INIT_LOOP) {
+ if (loop > INIT_LOOP) {
wl1251_error("timeout waiting for the hardware to "
"complete initialization");
return -EIO;
next prev parent reply other threads:[~2009-07-16 10:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-06 19:20 [PATCH] wl12xx: loop off by one Roel Kluin
2009-07-16 9:23 ` Kalle Valo
2009-07-16 10:36 ` Roel Kluin [this message]
2009-07-16 13:44 ` Kalle Valo
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=4A5F02C9.50505@gmail.com \
--to=roel.kluin@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=kalle.valo@nokia.com \
--cc=linux-wireless@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.