Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac8cf0b9 authored by Boris Brezillon's avatar Boris Brezillon Committed by Miquel Raynal
Browse files

mtd: rawnand: micron: Update ecc_stats.corrected



Even if we can't update ecc_stats.corrected with an accurate value we
should at least increase the number of bitflips so that MTD users can
know that there was some bitflips.

Just add chip->ecc.strength to mtd->ecc_stats.corrected which should
account for the worst case situation.

Signed-off-by: default avatarBoris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent efc6362c
Loading
Loading
Loading
Loading
+11 −10
Original line number Diff line number Diff line
@@ -137,9 +137,9 @@ micron_nand_read_page_on_die_ecc(struct mtd_info *mtd, struct nand_chip *chip,
	if (ret)
		goto out;

	if (status & NAND_STATUS_FAIL)
	if (status & NAND_STATUS_FAIL) {
		mtd->ecc_stats.failed++;

	} else if (status & NAND_STATUS_WRITE_RECOMMENDED) {
		/*
		 * The internal ECC doesn't tell us the number of bitflips
		 * that have been corrected, but tells us if it recommends to
@@ -147,8 +147,9 @@ micron_nand_read_page_on_die_ecc(struct mtd_info *mtd, struct nand_chip *chip,
		 * a number of bitflips equal to the ECC strength, which will
		 * hint the NAND core to rewrite the block.
		 */
	else if (status & NAND_STATUS_WRITE_RECOMMENDED)
		mtd->ecc_stats.corrected += chip->ecc.strength;
		max_bitflips = chip->ecc.strength;
	}

	ret = nand_read_data_op(chip, buf, mtd->writesize, false);
	if (!ret && oob_required)