Skip to contentSkip to conversation

ntd: nand: Fix unconditional message "CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED is disabled"

PATCH Applied Alexander Shiyan 2 participants 2 messages Nov 6, 2024 – Nov 8, 2024

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

PATCH 1/1 ntd: nand: Fix unconditional message "CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED is disabled"

The message "CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED is disabled" is always issued, regardless of the MTD ECC layout used, since it is executed through "fallthrough" from the previous case statement.

Additionally, if !IS_ENABLED(CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED) is triggered, the patch calls break, which disables the additional checks.

---
 drivers/mtd/nand/raw/nand_base.c | 35 ++++++++++++++++----------------
 1 file changed, 18 insertions(+), 17 deletions(-)
drivers/mtd/nand/raw/nand_base.c +18 -17
index e586c4cc89..4ecad0a935 100644
@@ -5671,10 +5671,6 @@ static int nand_set_ecc_on_host_ops(struct nand_chip *chip)
 		fallthrough;
 
 	case NAND_ECC_PLACEMENT_INTERLEAVED:
-		if (!IS_ENABLED(CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED)) {
-			WARN(1, "CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED is disabled\n");
-			break;
-		}
 		if ((!ecc->calculate || !ecc->correct || !ecc->hwctl) &&
 		    (!ecc->read_page ||
 		     ecc->read_page == nand_read_page_hwecc ||
@@ -5683,19 +5679,24 @@ static int nand_set_ecc_on_host_ops(struct nand_chip *chip)
 			WARN(1, "No ECC functions supplied; hardware ECC not possible\n");
 			return -EINVAL;
 		}
-		/* Use standard syndrome read/write page function? */
-		if (!ecc->read_page)
-			ecc->read_page = nand_read_page_syndrome;
-		if (!ecc->write_page)
-			ecc->write_page = nand_write_page_syndrome;
-		if (!ecc->read_page_raw)
-			ecc->read_page_raw = nand_read_page_raw_syndrome;
-		if (!ecc->write_page_raw)
-			ecc->write_page_raw = nand_write_page_raw_syndrome;
-		if (!ecc->read_oob)
-			ecc->read_oob = nand_read_oob_syndrome;
-		if (!ecc->write_oob)
-			ecc->write_oob = nand_write_oob_syndrome;
+		if (IS_ENABLED(CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED)) {
+			/* Use standard syndrome read/write page function? */
+			if (!ecc->read_page)
+				ecc->read_page = nand_read_page_syndrome;
+			if (!ecc->write_page)
+				ecc->write_page = nand_write_page_syndrome;
+			if (!ecc->read_page_raw)
+				ecc->read_page_raw = nand_read_page_raw_syndrome;
+			if (!ecc->write_page_raw)
+				ecc->write_page_raw = nand_write_page_raw_syndrome;
+			if (!ecc->read_oob)
+				ecc->read_oob = nand_read_oob_syndrome;
+			if (!ecc->write_oob)
+				ecc->write_oob = nand_write_oob_syndrome;
+		} else {
+			if (ecc->placement == NAND_ECC_PLACEMENT_INTERLEAVED)
+				WARN(1, "CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED is disabled\n");
+		}
 		break;
 
 	default:
Signature · 1 line
2.39.1
Applied
#1 lore raw
Quoted 8 lines · Alexander Shiyan

The message "CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED is disabled" is always issued, regardless of the MTD ECC layout used, since it is executed through "fallthrough" from the previous case statement.

Additionally, if !IS_ENABLED(CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED) is triggered, the patch calls break, which disables the additional checks.

[...]

Applied, thanks!

[1/1] ntd: nand: Fix unconditional message "CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED is disabled"
https://git.pengutronix.de/cgit/barebox/commit/?id=4ae4449d63fc (link may not be stable)

Best regards,

Signature · 1 line
Sascha Hauer <[email protected]>