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 9b5218b6ada80095a7a525749c58c0ad619a46f8..4e6e451cd5c8112bf9f4049e5bfdf986b3a249a5 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);