[PATCH 07/12] mtd: nand: return failure when failing to get ECC from ONFI

Huang Shijie b32955 at freescale.com
Wed Sep 4 22:34:21 EDT 2013


于 2013年09月05日 02:25, Brian Norris 写道:
> If ONFI fails to provide ECC information, we should not use it. Print
> appropriate error messages and return.
>
> Signed-off-by: Brian Norris <computersforpeace at gmail.com>
> Cc: Huang Shijie <b32955 at freescale.com>
> ---
>  drivers/mtd/nand/nand_base.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index 7ed4841..38b8dd4 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -3010,8 +3010,13 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip,
>  			chip->cmdfunc = nand_command_lp;
>  
>  		/* The Extended Parameter Page is supported since ONFI 2.1. */
> -		if (nand_flash_detect_ext_param_page(mtd, chip, p))
> -			pr_info("Failed to detect the extended param page.\n");
> +		if (nand_flash_detect_ext_param_page(mtd, chip, p)) {
> +			pr_info("Failed to detect ONFI extended param page\n");
> +			return 0;
> +		}
> +	} else {
> +		pr_err("Could not retrieve ONFI ECC requirements\n");
> +		return 0;
This return will skips the message "ONFI flash detected", could we
remove the 'return' from this patch?

most of the drivers will not use the ECC info, so i think even we fail
to detect the ECC info
we do not need to skip the message "ONFI flash detected".

My suggestion is to use the pr_warn() to just print out the warning,
such as:
pr_warn("Could not retrieve ONFI ECC requirements\n");



thanks
Huang Shijie

>  	}
>  
>  	pr_info("ONFI flash detected\n");





More information about the linux-mtd mailing list