]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mtd: rawnand: sunxi: change error prone variable name
authorRichard Genoud <richard.genoud@bootlin.com>
Tue, 17 Mar 2026 14:24:35 +0000 (15:24 +0100)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 25 Mar 2026 14:27:30 +0000 (15:27 +0100)
In sunxi_nand_hw_ecc_ctrl_init(), i is used as a loop index variable and
at the same time as the value used to set ECC mode in ECC control
register.
To prevent it from being re-used as a loop variable, let's change the
naming to ecc_mode.

No functional change.

Signed-off-by: Richard Genoud <richard.genoud@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/raw/sunxi_nand.c

index 68e22ce451dbbdfd78e41925598063fa4ecda727..81e491be3563ca652607ed2ba89afbd2cbe51ea1 100644 (file)
@@ -1796,6 +1796,7 @@ static int sunxi_nand_hw_ecc_ctrl_init(struct nand_chip *nand,
        struct mtd_info *mtd = nand_to_mtd(nand);
        struct nand_device *nanddev = mtd_to_nanddev(mtd);
        int nsectors;
+       int ecc_mode;
        int i;
 
        if (nanddev->ecc.user_conf.flags & NAND_ECC_MAXIMIZE_STRENGTH) {
@@ -1849,18 +1850,18 @@ static int sunxi_nand_hw_ecc_ctrl_init(struct nand_chip *nand,
        }
 
        /* Add ECC info retrieval from DT */
-       for (i = 0; i < nfc->caps->nstrengths; i++) {
-               if (ecc->strength <= strengths[i]) {
+       for (ecc_mode = 0; ecc_mode < nfc->caps->nstrengths; ecc_mode++) {
+               if (ecc->strength <= strengths[ecc_mode]) {
                        /*
                         * Update ecc->strength value with the actual strength
                         * that will be used by the ECC engine.
                         */
-                       ecc->strength = strengths[i];
+                       ecc->strength = strengths[ecc_mode];
                        break;
                }
        }
 
-       if (i >= nfc->caps->nstrengths) {
+       if (ecc_mode >= nfc->caps->nstrengths) {
                dev_err(nfc->dev, "unsupported strength\n");
                return -ENOTSUPP;
        }
@@ -1896,7 +1897,7 @@ static int sunxi_nand_hw_ecc_ctrl_init(struct nand_chip *nand,
        ecc->read_oob_raw = nand_read_oob_std;
        ecc->write_oob_raw = nand_write_oob_std;
 
-       sunxi_nand->ecc.ecc_ctl = NFC_ECC_MODE(nfc, i) | NFC_ECC_EXCEPTION |
+       sunxi_nand->ecc.ecc_ctl = NFC_ECC_MODE(nfc, ecc_mode) | NFC_ECC_EXCEPTION |
                                  NFC_ECC_PIPELINE | NFC_ECC_EN;
 
        if (ecc->size == 512) {