[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1620697235-7829-3-git-send-email-ycllin@mxic.com.tw>
Date: Tue, 11 May 2021 09:40:35 +0800
From: YouChing Lin <ycllin@...c.com.tw>
To: miquel.raynal@...tlin.com, richard@....at, vigneshr@...com
Cc: linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org,
juliensu@...c.com.tw, YouChing Lin <ycllin@...c.com.tw>
Subject: [PATCH 2/2] mtd: nand: ecc-hamming: Fix the double counting of ECC stat
If you use SPI-NAND with SW-ECC engine, the ECC related statistics
(ecc_stats.failed & ecc_stats.corrected) will be doubled, because
those numbers will be double-counted in ecc-sw-hamming.c and
drivers/mtd/nand/spi/core.c.
This can be found by using nandtest/nandbiterrs validation.
Signed-off-by: YouChing Lin <ycllin@...c.com.tw>
---
drivers/mtd/nand/ecc-sw-hamming.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/ecc-sw-hamming.c b/drivers/mtd/nand/ecc-sw-hamming.c
index a7655b6..e8a30cf 100644
--- a/drivers/mtd/nand/ecc-sw-hamming.c
+++ b/drivers/mtd/nand/ecc-sw-hamming.c
@@ -625,11 +625,12 @@ static int nand_ecc_sw_hamming_finish_io_req(struct nand_device *nand,
&ecccode[i],
&ecccalc[i]);
if (stat < 0) {
- mtd->ecc_stats.failed++;
- } else {
- mtd->ecc_stats.corrected += stat;
- max_bitflips = max_t(unsigned int, max_bitflips, stat);
+ nand_ecc_restore_req(&engine_conf->req_ctx, req);
+
+ return -EBADMSG;
}
+
+ max_bitflips = max_t(unsigned int, max_bitflips, stat);
}
nand_ecc_restore_req(&engine_conf->req_ctx, req);
--
1.9.1
Powered by blists - more mailing lists