Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <roel.kluin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Roel Kluin and committed by
Greg Kroah-Hartman
f991a65c 8d72f98a

+2 -2
+1 -1
drivers/staging/rt2860/common/mlme.c
··· 7866 7866 RTMPusecDelay(2); 7867 7867 } while(i++ < 100); 7868 7868 7869 - if (i >= 100) 7869 + if (i > 100) 7870 7870 { 7871 7871 { 7872 7872 #ifdef RT2860
+1 -1
drivers/staging/rt2860/common/rtmp_init.c
··· 3366 3366 RTMPusecDelay(1000); 3367 3367 } while (Index++ < 1000); 3368 3368 3369 - if (Index >= 1000) 3369 + if (Index > 1000) 3370 3370 { 3371 3371 Status = NDIS_STATUS_FAILURE; 3372 3372 DBGPRINT(RT_DEBUG_ERROR, ("NICLoadFirmware: MCU is not ready\n\n\n"));