[PATCH] MTD: treat any negative return value from correct() as an error

Jörn Engel joern at logfs.org
Sat Oct 20 13:40:06 EDT 2007

On Sat, 20 October 2007 09:37:16 -0700, Matt Reimer wrote:
> My mistake: I did most of this analysis in the 2.6.21 code, where
> cafe_ecc.c:cafe_correct_ecc() did return -EIO, not diskonchip.
> But as for the rest of the description, I'm just reading the code
> that's there. An error return from ecc.correct bumps stats.failed,
> which in nand_do_read_ops does become -EBADMSG:
>         if (mtd->ecc_stats.failed - stats.failed)
>                 return -EBADMSG;
>         return  mtd->ecc_stats.corrected - stats.corrected ? -EUCLEAN : 0;
> So I was just following what I found there, assuming it was standard practice.

Fair enough.  Description aside, your patch, my two, plus your patch to
return -1 on uncorrectable ecc errors instead of 0 should be turned into
a patch series.  Better yet, change your patch to return -EBADMSG.

Do you volunteer or should I do it?


Data expands to fill the space available for storage.
-- Parkinson's Law

More information about the linux-mtd mailing list