Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Richard Genoud and committed by
Miquel Raynal
a1c967f5 2781542c

+6 -5
+6 -5
drivers/mtd/nand/raw/sunxi_nand.c
··· 1796 1796 struct mtd_info *mtd = nand_to_mtd(nand); 1797 1797 struct nand_device *nanddev = mtd_to_nanddev(mtd); 1798 1798 int nsectors; 1799 + int ecc_mode; 1799 1800 int i; 1800 1801 1801 1802 if (nanddev->ecc.user_conf.flags & NAND_ECC_MAXIMIZE_STRENGTH) { ··· 1850 1849 } 1851 1850 1852 1851 /* Add ECC info retrieval from DT */ 1853 - for (i = 0; i < nfc->caps->nstrengths; i++) { 1854 - if (ecc->strength <= strengths[i]) { 1852 + for (ecc_mode = 0; ecc_mode < nfc->caps->nstrengths; ecc_mode++) { 1853 + if (ecc->strength <= strengths[ecc_mode]) { 1855 1854 /* 1856 1855 * Update ecc->strength value with the actual strength 1857 1856 * that will be used by the ECC engine. 1858 1857 */ 1859 - ecc->strength = strengths[i]; 1858 + ecc->strength = strengths[ecc_mode]; 1860 1859 break; 1861 1860 } 1862 1861 } 1863 1862 1864 - if (i >= nfc->caps->nstrengths) { 1863 + if (ecc_mode >= nfc->caps->nstrengths) { 1865 1864 dev_err(nfc->dev, "unsupported strength\n"); 1866 1865 return -ENOTSUPP; 1867 1866 } ··· 1897 1896 ecc->read_oob_raw = nand_read_oob_std; 1898 1897 ecc->write_oob_raw = nand_write_oob_std; 1899 1898 1900 - sunxi_nand->ecc.ecc_ctl = NFC_ECC_MODE(nfc, i) | NFC_ECC_EXCEPTION | 1899 + sunxi_nand->ecc.ecc_ctl = NFC_ECC_MODE(nfc, ecc_mode) | NFC_ECC_EXCEPTION | 1901 1900 NFC_ECC_PIPELINE | NFC_ECC_EN; 1902 1901 1903 1902 if (ecc->size == 512) {