[PATCH] nand: fix .correct callback return value check
Baruch Siach
baruch at tkos.co.il
Thu Aug 12 01:42:38 EDT 2010
Hi linux-mtd list,
Ping?
At least the atmel_nand and the bf5xx_nand drivers may return -EIO for
uncorrectable errors, so this patch fixes a real bug.
baruch
On Mon, Aug 09, 2010 at 07:20:23AM +0300, Baruch Siach wrote:
> Drivers may (and do) return negative errno values other than -1 from the
> .correct callback.
>
> Signed-off-by: Baruch Siach <baruch at tkos.co.il>
> ---
> drivers/mtd/nand/nand_base.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index 4a7b864..080f551 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -1210,7 +1210,7 @@ static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip, uint3
> int stat;
>
> stat = chip->ecc.correct(mtd, p, &chip->buffers->ecccode[i], &chip->buffers->ecccalc[i]);
> - if (stat == -1)
> + if (stat < 0)
> mtd->ecc_stats.failed++;
> else
> mtd->ecc_stats.corrected += stat;
> --
> 1.7.1
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
More information about the linux-mtd
mailing list