diff mbox series

mtd: rawnand: atmel: Update ecc_stats.corrected counter

Message ID 20210322150714.101585-1-tudor.ambarus@microchip.com (mailing list archive)
State New, archived
Headers show
Series mtd: rawnand: atmel: Update ecc_stats.corrected counter | expand

Commit Message

Tudor Ambarus March 22, 2021, 3:07 p.m. UTC
From: "Kai Stuhlemmer (ebee Engineering)" <kai.stuhlemmer@ebee.de>

Update MTD ECC statistics with the number of corrected bits.

Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
Cc: stable@vger.kernel.org
Signed-off-by: Kai Stuhlemmer (ebee Engineering) <kai.stuhlemmer@ebee.de>
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
 drivers/mtd/nand/raw/atmel/nand-controller.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Miquel Raynal March 28, 2021, 5:14 p.m. UTC | #1
On Mon, 2021-03-22 at 15:07:14 UTC, Tudor Ambarus wrote:
> From: "Kai Stuhlemmer (ebee Engineering)" <kai.stuhlemmer@ebee.de>
> 
> Update MTD ECC statistics with the number of corrected bits.
> 
> Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Kai Stuhlemmer (ebee Engineering) <kai.stuhlemmer@ebee.de>
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c
index e6ceec8f50dc..8aab1017b460 100644
--- a/drivers/mtd/nand/raw/atmel/nand-controller.c
+++ b/drivers/mtd/nand/raw/atmel/nand-controller.c
@@ -883,10 +883,12 @@  static int atmel_nand_pmecc_correct_data(struct nand_chip *chip, void *buf,
 							  NULL, 0,
 							  chip->ecc.strength);
 
-		if (ret >= 0)
+		if (ret >= 0) {
+			mtd->ecc_stats.corrected += ret;
 			max_bitflips = max(ret, max_bitflips);
-		else
+		} else {
 			mtd->ecc_stats.failed++;
+		}
 
 		databuf += chip->ecc.size;
 		eccbuf += chip->ecc.bytes;