[PATCH] drivers: mmc: check the return value of mmc_send_if_cond() call

정재훈 jh80.chung at samsung.com
Fri Oct 21 11:07:59 CEST 2022


> -----Original Message-----
> From: Matt Ranostay [mailto:mranostay at ti.com]
> Sent: Friday, October 21, 2022 4:16 PM
> To: peng.fan at nxp.com; jh80.chung at samsung.com
> Cc: u-boot at lists.denx.de; Matt Ranostay <mranostay at ti.com>
> Subject: [PATCH] drivers: mmc: check the return value of mmc_send_if_cond() call
> 
> Return value from mmc_send_if_cond() isn't checked if it is a error state
> and the result immediately is overwritten with the sd_send_op_cond() call.
> 
> Add check for -EOPNOTSUPP to fail early, and trigger a retry for any other
> error code.
> 
> Fixes: afd5932b2c27 ("Revert "mmc: retry the cmd8 to meet 74 clocks requirement in the spec")
> Signed-off-by: Matt Ranostay <mranostay at ti.com>

Reviewed-by: Jaehoon Chung <jh80.chung at samsung.com>

Best Regards,
Jaehoon Chung

> ---
>  drivers/mmc/mmc.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 0b7c0be8cbc..e26a457a74c 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -2862,6 +2862,13 @@ retry:
> 
>  	/* Test for SD version 2 */
>  	err = mmc_send_if_cond(mmc);
> +	if (err == -EOPNOTSUPP)
> +		return err;
> +
> +	if (err) {
> +		mmc_power_cycle(mmc);
> +		goto retry;
> +	}
> 
>  	/* Now try to get the SD card's operating condition */
>  	err = sd_send_op_cond(mmc, uhs_en);
> --
> 2.38.GIT




More information about the U-Boot mailing list