[PATCH 6/8] mxc_nand: fix correct_data function

Sascha Hauer s.hauer at pengutronix.de
Sun Aug 8 16:43:41 EDT 2010


On Sun, Aug 08, 2010 at 11:32:44AM +0300, Baruch Siach wrote:
> Hi Russell,
> 
> On Sun, Aug 08, 2010 at 09:19:56AM +0100, Russell King - ARM Linux wrote:
> > On Fri, Aug 06, 2010 at 03:53:09PM +0200, Sascha Hauer wrote:
> > > +		err = ecc_stat & ecc_bit_mask;
> > > +		if (err > err_limit) {
> > > +			printk(KERN_WARNING "UnCorrectable RS-ECC Error\n");
> > > +			return -1;
> > 
> > Someone's being lazy.
> 
> The code at nand_read_subpage() (drivers/mtd/nand/nand_base.c) expects the 
> .correct callback to return -1 on an uncorrectable error:
> 
>                 stat = chip->ecc.correct(mtd, p, &chip->buffers->ecccode[i], &chip->buffers->ecccalc[i]);
>                 if (stat == -1)
>                         mtd->ecc_stats.failed++;
>                 else
>                         mtd->ecc_stats.corrected += stat;

Then this should be changed to check for stat < 0. I found some drivers
in the tree returning an errno value in their .correct function instead
of -1.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the linux-arm-kernel mailing list