[U-Boot] [PATCH 13/18] mmc: the ext_csd data may be used during init even if reading failed

Pantelis Antoniou panto at antoniou-consulting.com
Fri Nov 28 11:17:52 CET 2014


> On Nov 28, 2014, at 11:10 , Diego Santa Cruz <Diego.SantaCruz at spinetix.com> wrote:
> 
> The mmc_startup() function uses the ext_csd data even if reading it
> from the mmc device failed. This bug was introduced in commit
> bc897b1d4d86597311430dbe7b3e6c807c8c53e5. We now bail out if
> reading it fails, this should not be a problem as ext_csd was
> introduced in MMC 4.0 and this code is conditional on MMC >= 4.0.
> ---
> drivers/mmc/mmc.c |    4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index f545576..8f6cbd5 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -972,7 +972,9 @@ static int mmc_startup(struct mmc *mmc)
> 	if (!IS_SD(mmc) && (mmc->version >= MMC_VERSION_4)) {
> 		/* check  ext_csd version and capacity */
> 		err = mmc_send_ext_csd(mmc, ext_csd);
> -		if (!err && (ext_csd[EXT_CSD_REV] >= 2)) {
> +		if (err)
> +			return err;

Hum, good catch.

> +		if (ext_csd[EXT_CSD_REV] >= 2) {
> 			/*
> 			 * According to the JEDEC Standard, the value of
> 			 * ext_csd's capacity is valid if the value is more
> -- 
> 1.7.1
> 



More information about the U-Boot mailing list