[NAND flash driver] What would mtd do if read returns -EBADMSG (ecc failed)

Du Zhongdong axdududu at gmail.com
Tue Oct 21 02:11:45 EDT 2008


Hi,

I'm doing a NAND flash driver, and I suppose if ecc cannot be
corrected while read something from NAND flash, that block should be
marked bad, is that right?

Reading through nand_base.c I notice that mtd->read = nand_read;
nand_read() [MTD Interface] calls nand_do_read_ops() [Internal] to do
the work,  and in nand_do_read_ops():
        if (mtd->ecc_stats.failed - stats.failed)
		return -EBADMSG;
-EBADMSG then is returned to the MTD layer. I tried to trace this
information in the MTD code, but there seems to be so many and I
cannot be sure how MTD handles this "-EBADMSG".  Any help or
information is appreciated.


Best regards,
Du Zhongdong



More information about the linux-mtd mailing list