[PATCH] MTD: OneNAND: Return only negative error codes

Kyungmin Park kmpark at infradead.org
Fri Oct 12 05:30:34 EDT 2007


> The OneNAND driver was confusing JFFS2 by returning positive error
> codes.

It's only possible the write case error and it returns the positive 'ctrl' error.
Other case, "2-bit ecc error' is handled with 'mtd->ecc_stat' correctly.

Well, no problem to change to the negative value.

Acked-by: Kyungmin Park <kyungmin.park at samsung.com>

> 
> ---
>  drivers/mtd/onenand/onenand_base.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
> index f633941..a8c426b 100644
> --- a/drivers/mtd/onenand/onenand_base.c
> +++ b/drivers/mtd/onenand/onenand_base.c
> @@ -327,7 +327,7 @@ static int onenand_wait(struct mtd_info *mtd, int state)
>  		printk(KERN_ERR "onenand_wait: controller error = 0x%04x\n", ctrl);
>  		if (ctrl & ONENAND_CTRL_LOCK)
>  			printk(KERN_ERR "onenand_wait: it's locked error.\n");
> -		return ctrl;
> +		return -EIO;
>  	}
> 
>  	if (interrupt & ONENAND_INT_READ) {
> @@ -336,7 +336,7 @@ static int onenand_wait(struct mtd_info *mtd, int state)
>  			if (ecc & ONENAND_ECC_2BIT_ALL) {
>  				printk(KERN_ERR "onenand_wait: ECC error = 0x%04x\n", ecc);
>  				mtd->ecc_stats.failed++;
> -				return ecc;
> +				return -EBADMSG;
>  			} else if (ecc & ONENAND_ECC_1BIT_ALL) {
>  				printk(KERN_INFO "onenand_wait: correctable ECC error = 0x%04x\n", ecc);
>  				mtd->ecc_stats.corrected++;
> --
> 1.4.4.2





More information about the linux-mtd mailing list