diff mbox series

mmc: core: clear 'doing_init_tune' also after failures

Message ID 20200914112845.21855-1-wsa+renesas@sang-engineering.com (mailing list archive)
State New, archived
Headers show
Series mmc: core: clear 'doing_init_tune' also after failures | expand

Commit Message

Wolfram Sang Sept. 14, 2020, 11:28 a.m. UTC
Reorganize the code, so that the flag is always cleared independently of
a good or bad case.

Fixes: 97a7d87e96b0 ("mmc: core: add a 'doing_init_tune' flag and a 'mmc_doing_tune' helper")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Sorry for overlooking this :(

 drivers/mmc/core/mmc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Niklas Söderlund Sept. 14, 2020, 11:54 a.m. UTC | #1
Hi Wolfram,

Thanks for your work.

On 2020-09-14 13:28:45 +0200, Wolfram Sang wrote:
> Reorganize the code, so that the flag is always cleared independently of
> a good or bad case.
> 
> Fixes: 97a7d87e96b0 ("mmc: core: add a 'doing_init_tune' flag and a 'mmc_doing_tune' helper")
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
> 
> Sorry for overlooking this :(
> 
>  drivers/mmc/core/mmc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 67e95eba0e82..ff3063ce2acd 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1766,14 +1766,14 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
>  		host->doing_init_tune = 1;
>  
>  		err = mmc_hs200_tuning(card);
> -		if (err)
> -			goto free_card;
> +		if (!err)
> +			err = mmc_select_hs400(card);
> +
> +		host->doing_init_tune = 0;
>  
> -		err = mmc_select_hs400(card);
>  		if (err)
>  			goto free_card;
>  
> -		host->doing_init_tune = 0;
>  	} else if (!mmc_card_hs400es(card)) {
>  		/* Select the desired bus width optionally */
>  		err = mmc_select_bus_width(card);
> -- 
> 2.20.1
>
Ulf Hansson Sept. 14, 2020, 11:58 a.m. UTC | #2
On Mon, 14 Sep 2020 at 13:28, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> Reorganize the code, so that the flag is always cleared independently of
> a good or bad case.
>
> Fixes: 97a7d87e96b0 ("mmc: core: add a 'doing_init_tune' flag and a 'mmc_doing_tune' helper")
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied for next, thanks!

Kind regards
Uffe

> ---
>
> Sorry for overlooking this :(
>
>  drivers/mmc/core/mmc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 67e95eba0e82..ff3063ce2acd 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1766,14 +1766,14 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
>                 host->doing_init_tune = 1;
>
>                 err = mmc_hs200_tuning(card);
> -               if (err)
> -                       goto free_card;
> +               if (!err)
> +                       err = mmc_select_hs400(card);
> +
> +               host->doing_init_tune = 0;
>
> -               err = mmc_select_hs400(card);
>                 if (err)
>                         goto free_card;
>
> -               host->doing_init_tune = 0;
>         } else if (!mmc_card_hs400es(card)) {
>                 /* Select the desired bus width optionally */
>                 err = mmc_select_bus_width(card);
> --
> 2.20.1
>
diff mbox series

Patch

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 67e95eba0e82..ff3063ce2acd 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1766,14 +1766,14 @@  static int mmc_init_card(struct mmc_host *host, u32 ocr,
 		host->doing_init_tune = 1;
 
 		err = mmc_hs200_tuning(card);
-		if (err)
-			goto free_card;
+		if (!err)
+			err = mmc_select_hs400(card);
+
+		host->doing_init_tune = 0;
 
-		err = mmc_select_hs400(card);
 		if (err)
 			goto free_card;
 
-		host->doing_init_tune = 0;
 	} else if (!mmc_card_hs400es(card)) {
 		/* Select the desired bus width optionally */
 		err = mmc_select_bus_width(card);