From: Roel Kluin Date: Wed, 13 May 2009 18:37:54 +0000 (+0200) Subject: staging: rtlxxxx: off by one in AsicSendCommandToMcu() and NDIS_STATUS NICLoadFirmware() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f991a65c0cb8eaf855404a0e6c753053de08cdda;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git staging: rtlxxxx: off by one in AsicSendCommandToMcu() and NDIS_STATUS NICLoadFirmware() With a postfix increment i/Index is incremented beyond 100/1000 so the message will be displayed too soon. Signed-off-by: Roel Kluin Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rt2860/common/mlme.c b/drivers/staging/rt2860/common/mlme.c index e9e69c539e6f..bb6fccbdca41 100644 --- 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 diff --git a/drivers/staging/rt2860/common/rtmp_init.c b/drivers/staging/rt2860/common/rtmp_init.c index c2facac5cf88..004f53023b0f 100644 --- 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"));