mtd: nand: omap: fix omap_calculate_ecc_bch() for-loop error

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Tue Jun 10 23:59:10 PDT 2014


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=2913aae5f9eae2f857cdeff5388bb22d0751aa08
Commit:     2913aae5f9eae2f857cdeff5388bb22d0751aa08
Parent:     ab7f6fcec33a01279d2abeaf1c4ccdfa8a5d93ff
Author:     Ted Juan <ted.juan at gmail.com>
AuthorDate: Wed May 28 22:33:06 2014 +0800
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Wed May 28 13:13:00 2014 -0700

    mtd: nand: omap: fix omap_calculate_ecc_bch() for-loop error
    
     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 at vger.kernel.org> # 3.13.x+
    Signed-off-by: Ted Juan <ted.juan at gmail.com>
    Acked-by: Pekon Gupta <pekon at ti.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/nand/omap2.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index cbe87a8..f0ed92e 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -1180,7 +1180,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++) {
@@ -1263,8 +1263,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 */
@@ -1273,8 +1273,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 */



More information about the linux-mtd-cvs mailing list