]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/kernel-video.git/commitdiff
mtd: nand: omap: fix omap_calculate_ecc_bch() for-loop error
authorTed Juan <ted.juan@gmail.com>
Wed, 28 May 2014 14:33:06 +0000 (22:33 +0800)
committerSekhar Nori <nsekhar@ti.com>
Mon, 21 Jul 2014 12:49:58 +0000 (18:19 +0530)
[ Upstream commit 2913aae5f9eae2f857cdeff5388bb22d0751aa08 ]

Fixes: 2c9f2365d1e1d0e318b068f683f18c99515b80f8
 mtd: nand: omap: ecc.calculate: merge omap3_calculate_ecc_bch4 in omap_calculate_ecc_bch

Fixes: 7bcd1dca1d587ad29f9825ba4414620440e8c8da
 mtd: nand: omap: ecc.calculate: merge omap3_calculate_ecc_bch8 in omap_calculate_ecc_bch

Cc: <stable@vger.kernel.org> # 3.13.x+
Signed-off-by: Ted Juan <ted.juan@gmail.com>
Acked-by: Pekon Gupta <pekon@ti.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
drivers/mtd/nand/omap2.c

index 46d3992b80c10c63abdd5960346eed06d720500c..781ef9b052ad4ac522ffdc23f7fd61a11f9da41f 100644 (file)
@@ -1181,7 +1181,7 @@ static int __maybe_unused omap_calculate_ecc_bch(struct mtd_info *mtd,
        u8 *ecc_code;
        unsigned long nsectors, bch_val1, bch_val2, bch_val3, bch_val4;
        u32 val;
-       int i;
+       int i, j;
 
        nsectors = ((readl(info->reg.gpmc_ecc_config) >> 4) & 0x7) + 1;
        for (i = 0; i < nsectors; i++) {
@@ -1264,8 +1264,8 @@ static int __maybe_unused omap_calculate_ecc_bch(struct mtd_info *mtd,
                case OMAP_ECC_BCH4_CODE_HW_DETECTION_SW:
                        /* Add constant polynomial to remainder, so that
                         * ECC of blank pages results in 0x0 on reading back */
-                       for (i = 0; i < eccbytes; i++)
-                               ecc_calc[i] ^= bch4_polynomial[i];
+                       for (j = 0; j < eccbytes; j++)
+                               ecc_calc[j] ^= bch4_polynomial[j];
                        break;
                case OMAP_ECC_BCH4_CODE_HW:
                        /* Set  8th ECC byte as 0x0 for ROM compatibility */
@@ -1274,8 +1274,8 @@ static int __maybe_unused omap_calculate_ecc_bch(struct mtd_info *mtd,
                case OMAP_ECC_BCH8_CODE_HW_DETECTION_SW:
                        /* Add constant polynomial to remainder, so that
                         * ECC of blank pages results in 0x0 on reading back */
-                       for (i = 0; i < eccbytes; i++)
-                               ecc_calc[i] ^= bch8_polynomial[i];
+                       for (j = 0; j < eccbytes; j++)
+                               ecc_calc[j] ^= bch8_polynomial[j];
                        break;
                case OMAP_ECC_BCH8_CODE_HW:
                        /* Set 14th ECC byte as 0x0 for ROM compatibility */