[U-Boot] [PATCH] nand: fixed failed reads on corrected ECC errors in nand_util.c

Scott Wood scottwood at freescale.com
Thu Jul 16 21:50:35 CEST 2009


On Tue, Jul 14, 2009 at 01:51:10PM +0300, Valeriy Glushkov wrote:
> 
> Signed-off-by: Valeriy Glushkov <gvv at lstec.com>
> Signed-off-by: Paulraj, Sandeep <s-paulraj at ti.com>
> ---

Applied to u-boot-nand-flash.

>  drivers/mtd/nand/nand_util.c |   10 +++++-----
>  1 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mtd/nand/nand_util.c b/drivers/mtd/nand/nand_util.c
> index fc16282..694ead6 100644
> --- a/drivers/mtd/nand/nand_util.c
> +++ b/drivers/mtd/nand/nand_util.c
> @@ -567,10 +567,10 @@ int nand_read_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
>  
>  	if (len_incl_bad == *length) {
>  		rval = nand_read (nand, offset, length, buffer);
> -		if (rval != 0)
> -			printf ("NAND read from offset %llx failed %d\n",
> -				offset, rval);
> -
> +		if (!rval || rval == -EUCLEAN)
> +			return 0;
> +		printf ("NAND read from offset %llx failed %d\n",
> +			offset, rval);

Out of curiosity, why invert the logic from if (error) print; return to if
(!error) return; print; return?

-Scott


More information about the U-Boot mailing list