staging: rtlxxxx: off by one in AsicSendCommandToMcu() and NDIS_STATUS NICLoadFirmware()

From: Roel Kluin
Date: Wed May 13 2009 - 14:37:54 EST



With a postfix increment i/Index is incremented beyond 100/1000 so the
message will be displayed too soon.

Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
drivers/staging/rt2860/common/mlme.c | 2 +-
drivers/staging/rt2860/common/rtmp_init.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/staging/rt2860/common/mlme.c
+++ b/drivers/staging/rt2860/common/mlme.c
@@ -7866,7 +7866,7 @@ BOOLEAN AsicSendCommandToMcu(
RTMPusecDelay(2);
} while(i++ < 100);

- if (i >= 100)
+ if (i > 100)
{
{
#ifdef RT2860
--- a/drivers/staging/rt2860/common/rtmp_init.c
+++ b/drivers/staging/rt2860/common/rtmp_init.c
@@ -3366,7 +3366,7 @@ NDIS_STATUS NICLoadFirmware(
RTMPusecDelay(1000);
} while (Index++ < 1000);

- if (Index >= 1000)
+ if (Index > 1000)
{
Status = NDIS_STATUS_FAILURE;
DBGPRINT(RT_DEBUG_ERROR, ("NICLoadFirmware: MCU is not ready\n\n\n"));

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/