Skip to content

Commit a1c967f

Browse files
richard-bootlinmiquelraynal
authored andcommitted
mtd: rawnand: sunxi: change error prone variable name
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>
1 parent 2781542 commit a1c967f

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

drivers/mtd/nand/raw/sunxi_nand.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,6 +1796,7 @@ static int sunxi_nand_hw_ecc_ctrl_init(struct nand_chip *nand,
17961796
struct mtd_info *mtd = nand_to_mtd(nand);
17971797
struct nand_device *nanddev = mtd_to_nanddev(mtd);
17981798
int nsectors;
1799+
int ecc_mode;
17991800
int i;
18001801

18011802
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,
18491850
}
18501851

18511852
/* Add ECC info retrieval from DT */
1852-
for (i = 0; i < nfc->caps->nstrengths; i++) {
1853-
if (ecc->strength <= strengths[i]) {
1853+
for (ecc_mode = 0; ecc_mode < nfc->caps->nstrengths; ecc_mode++) {
1854+
if (ecc->strength <= strengths[ecc_mode]) {
18541855
/*
18551856
* Update ecc->strength value with the actual strength
18561857
* that will be used by the ECC engine.
18571858
*/
1858-
ecc->strength = strengths[i];
1859+
ecc->strength = strengths[ecc_mode];
18591860
break;
18601861
}
18611862
}
18621863

1863-
if (i >= nfc->caps->nstrengths) {
1864+
if (ecc_mode >= nfc->caps->nstrengths) {
18641865
dev_err(nfc->dev, "unsupported strength\n");
18651866
return -ENOTSUPP;
18661867
}
@@ -1896,7 +1897,7 @@ static int sunxi_nand_hw_ecc_ctrl_init(struct nand_chip *nand,
18961897
ecc->read_oob_raw = nand_read_oob_std;
18971898
ecc->write_oob_raw = nand_write_oob_std;
18981899

1899-
sunxi_nand->ecc.ecc_ctl = NFC_ECC_MODE(nfc, i) | NFC_ECC_EXCEPTION |
1900+
sunxi_nand->ecc.ecc_ctl = NFC_ECC_MODE(nfc, ecc_mode) | NFC_ECC_EXCEPTION |
19001901
NFC_ECC_PIPELINE | NFC_ECC_EN;
19011902

19021903
if (ecc->size == 512) {

0 commit comments

Comments
 (0)