Skip to content

Commit f9a13e0

Browse files
neosys007miquelraynal
authored andcommitted
mtd: rawnand: fsl_ifc: return errors for failed page reads
fsl_ifc_run_command() logs controller timeout and other non-OPC completion states in ctrl->nand_stat. fsl_ifc_read_page() then only increments the ECC failure counter for non-OPC status and still returns max_bitflips, which can be zero. Return -ETIMEDOUT when the command did not complete at all and -EIO for other non-OPC read completions so the NAND core does not treat a failed page read as a clean page. Fixes: 8277188 ("NAND Machine support for Integrated Flash Controller") Cc: stable@vger.kernel.org Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
1 parent d322e40 commit f9a13e0

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

drivers/mtd/nand/raw/fsl_ifc_nand.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,8 +684,15 @@ static int fsl_ifc_read_page(struct nand_chip *chip, uint8_t *buf,
684684
return check_erased_page(chip, buf);
685685
}
686686

687-
if (ctrl->nand_stat != IFC_NAND_EVTER_STAT_OPC)
687+
if (!ctrl->nand_stat) {
688688
mtd->ecc_stats.failed++;
689+
return -ETIMEDOUT;
690+
}
691+
692+
if (ctrl->nand_stat != IFC_NAND_EVTER_STAT_OPC) {
693+
mtd->ecc_stats.failed++;
694+
return -EIO;
695+
}
689696

690697
return nctrl->max_bitflips;
691698
}

0 commit comments

Comments
 (0)