staging: spectra: off by one
authorVasiliy Kulikov <segooon@gmail.com>
Sun, 19 Sep 2010 12:54:40 +0000 (16:54 +0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 21 Sep 2010 00:03:41 +0000 (17:03 -0700)
g_pBlockTable has only DeviceInfo.wDataBlockNum elements.

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/spectra/flash.c

index 9b5218b..4e6e451 100644 (file)
@@ -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);