Skip to contentSkip to conversation

zynq: mtd: nand: remove superfluous if

PATCH New Heinrich Schuchardt 2 participants 2 messages Dec 27, 2020 – Jan 4, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 zynq: mtd: nand: remove superfluous if

This sort of code does not make much sense:

    if (ondie_ecc_enabled) {
        if (ondie_ecc_enabled) {

Remove the inner if.

The problem was indicated by cppcheck.

---
 drivers/mtd/nand/raw/zynq_nand.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/mtd/nand/raw/zynq_nand.c +4 -6
index 92db2aa19c..65817ea7f2 100644
@@ -1206,12 +1206,10 @@ static int zynq_nand_probe(struct udevice *dev)
 		nand_chip->options |= NAND_SUBPAGE_READ;
 
 		/* On-Die ECC spare bytes offset 8 is used for ECC codes */
-		if (ondie_ecc_enabled) {
-			nand_chip->ecc.layout = &ondie_nand_oob_64;
-			/* Use the BBT pattern descriptors */
-			nand_chip->bbt_td = &bbt_main_descr;
-			nand_chip->bbt_md = &bbt_mirror_descr;
-		}
+		nand_chip->ecc.layout = &ondie_nand_oob_64;
+		/* Use the BBT pattern descriptors */
+		nand_chip->bbt_td = &bbt_main_descr;
+		nand_chip->bbt_md = &bbt_mirror_descr;
 	} else {
 		/* Hardware ECC generates 3 bytes ECC code for each 512 bytes */
 		nand_chip->ecc.mode = NAND_ECC_HW;

--
2.29.2

Applied
#1 lore raw

PATCH 1/1 zynq: mtd: nand: remove superfluous if

Quoted 36 lines · Heinrich Schuchardt

This sort of code does not make much sense:

    if (ondie_ecc_enabled) {
        if (ondie_ecc_enabled) {

Remove the inner if.

The problem was indicated by cppcheck.

---
 drivers/mtd/nand/raw/zynq_nand.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/mtd/nand/raw/zynq_nand.c +4 -7
index 92db2aa19c..65817ea7f2 100644
@@ -1206,12 +1206,10 @@ static int zynq_nand_probe(struct udevice *dev)
 		nand_chip->options |= NAND_SUBPAGE_READ;
 
 		/* On-Die ECC spare bytes offset 8 is used for ECC codes */
-		if (ondie_ecc_enabled) {
-			nand_chip->ecc.layout = &ondie_nand_oob_64;
-			/* Use the BBT pattern descriptors */
-			nand_chip->bbt_td = &bbt_main_descr;
-			nand_chip->bbt_md = &bbt_mirror_descr;
-		}
+		nand_chip->ecc.layout = &ondie_nand_oob_64;
+		/* Use the BBT pattern descriptors */
+		nand_chip->bbt_td = &bbt_main_descr;
+		nand_chip->bbt_md = &bbt_mirror_descr;
 	} else {
 		/* Hardware ECC generates 3 bytes ECC code for each 512 bytes */
 		nand_chip->ecc.mode = NAND_ECC_HW;
--
Quoted 2 lines

2.29.2

Applied.
M