diff mbox

[1/2] mmc: sdio: Check the return value of sdio_enable_4bit_bus

Message ID 1519694795-138735-1-git-send-email-shawn.lin@rock-chips.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shawn Lin Feb. 27, 2018, 1:26 a.m. UTC
Since we could move card->host->caps & MMC_CAP_4_BIT_DATA
ahead of mmc_sdio_init_uhs_card, in mmc_host_uhs(). So there
we could save this bit to check that. Also, if the process of
sdio_enable_4bit_bus goes wrong, we should bails out early.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

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

Comments

Ulf Hansson March 15, 2018, 10:23 a.m. UTC | #1
On 27 February 2018 at 02:26, Shawn Lin <shawn.lin@rock-chips.com> wrote:
> Since we could move card->host->caps & MMC_CAP_4_BIT_DATA
> ahead of mmc_sdio_init_uhs_card, in mmc_host_uhs(). So there
> we could save this bit to check that. Also, if the process of
> sdio_enable_4bit_bus goes wrong, we should bails out early.
>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>

Thanks, applied for next!

Kind regards
Uffe

> ---
>
>  drivers/mmc/core/sdio.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
> index cc43687..c599a62 100644
> --- a/drivers/mmc/core/sdio.c
> +++ b/drivers/mmc/core/sdio.c
> @@ -518,11 +518,10 @@ static int mmc_sdio_init_uhs_card(struct mmc_card *card)
>         if (!card->scr.sda_spec3)
>                 return 0;
>
> -       /*
> -        * Switch to wider bus (if supported).
> -        */
> -       if (card->host->caps & MMC_CAP_4_BIT_DATA)
> -               err = sdio_enable_4bit_bus(card);
> +       /* Switch to wider bus */
> +       err = sdio_enable_4bit_bus(card);
> +       if (err)
> +               goto out;
>
>         /* Set the driver strength for the card */
>         sdio_select_driver_type(card);
> --
> 1.9.1
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index cc43687..c599a62 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -518,11 +518,10 @@  static int mmc_sdio_init_uhs_card(struct mmc_card *card)
 	if (!card->scr.sda_spec3)
 		return 0;
 
-	/*
-	 * Switch to wider bus (if supported).
-	 */
-	if (card->host->caps & MMC_CAP_4_BIT_DATA)
-		err = sdio_enable_4bit_bus(card);
+	/* Switch to wider bus */
+	err = sdio_enable_4bit_bus(card);
+	if (err)
+		goto out;
 
 	/* Set the driver strength for the card */
 	sdio_select_driver_type(card);