Skip to contentSkip to conversation

staging: spectra: off by one

PATCH New Vasiliy Kulikov 1 participant 1 message Sep 19, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: spectra: off by one

g_pBlockTable has only DeviceInfo.wDataBlockNum elements.

---
compile tested.

 drivers/staging/spectra/flash.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/spectra/flash.c +1 -1
index 9b5218b..4e6e451 100644
@@ -1604,7 +1604,7 @@ static int get_l2_cache_blks(void)
 
 	for (n = 0; n < BLK_NUM_FOR_L2_CACHE; n++) {
 		blk = find_least_worn_blk_for_l2_cache();
-		if (blk > DeviceInfo.wDataBlockNum) {
+		if (blk >= DeviceInfo.wDataBlockNum) {
 			nand_dbg_print(NAND_DBG_WARN,
 				"find_least_worn_blk_for_l2_cache: "
 				"No enough free NAND blocks (n: %d) for L2 Cache!\n", n);
Signature · 1 line
1.7.0.4