diff mbox

[1/1] mmc: pwrseq: Fix error code propagation in mmc_pwrseq_simple_alloc()

Message ID 1428934061-29217-1-git-send-email-javier.martinez@collabora.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Javier Martinez Canillas April 13, 2015, 2:07 p.m. UTC
If the struct mmc_pwrseq_match .alloc function used to allocate a
struct mmc_pwrseq fails, the error is propagated to mmc_of_parse().

But instead of returning the error code in pwrseq, host->pwrseq is
returned which will always be 0. So mmc_of_parse() succeeds even if
the pwrseq .alloc function failed and host->pwrseq is NULL.

This makes the SDIO device to not be powered if the power sequencing
.alloc functions wants to be deferred due a missing resource because
the mmc controller driver probe did wrongly succeed.

Fixes: 0f12a0ce4ce4a ("mmc: pwrseq: simplify alloc/free hooks")
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
---
 drivers/mmc/core/pwrseq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexandre Courbot April 14, 2015, 2 a.m. UTC | #1
On 04/13/2015 11:07 PM, Javier Martinez Canillas wrote:
> If the struct mmc_pwrseq_match .alloc function used to allocate a
> struct mmc_pwrseq fails, the error is propagated to mmc_of_parse().
>
> But instead of returning the error code in pwrseq, host->pwrseq is
> returned which will always be 0. So mmc_of_parse() succeeds even if
> the pwrseq .alloc function failed and host->pwrseq is NULL.
>
> This makes the SDIO device to not be powered if the power sequencing
> .alloc functions wants to be deferred due a missing resource because
> the mmc controller driver probe did wrongly succeed.
>
> Fixes: 0f12a0ce4ce4a ("mmc: pwrseq: simplify alloc/free hooks")
> Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>

I obviously overlooked that one. Thanks for fixing it.

Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ulf Hansson April 14, 2015, 9:20 a.m. UTC | #2
On 13 April 2015 at 16:07, Javier Martinez Canillas
<javier.martinez@collabora.co.uk> wrote:
> If the struct mmc_pwrseq_match .alloc function used to allocate a
> struct mmc_pwrseq fails, the error is propagated to mmc_of_parse().
>
> But instead of returning the error code in pwrseq, host->pwrseq is
> returned which will always be 0. So mmc_of_parse() succeeds even if
> the pwrseq .alloc function failed and host->pwrseq is NULL.
>
> This makes the SDIO device to not be powered if the power sequencing
> .alloc functions wants to be deferred due a missing resource because
> the mmc controller driver probe did wrongly succeed.
>
> Fixes: 0f12a0ce4ce4a ("mmc: pwrseq: simplify alloc/free hooks")
> Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>

Thanks! Applied for fixes.

Kind regards
Uffe

> ---
>  drivers/mmc/core/pwrseq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/pwrseq.c b/drivers/mmc/core/pwrseq.c
> index ab2129781161..4c1d1757dbf9 100644
> --- a/drivers/mmc/core/pwrseq.c
> +++ b/drivers/mmc/core/pwrseq.c
> @@ -73,7 +73,7 @@ int mmc_pwrseq_alloc(struct mmc_host *host)
>
>         pwrseq = match->alloc(host, &pdev->dev);
>         if (IS_ERR(pwrseq)) {
> -               ret = PTR_ERR(host->pwrseq);
> +               ret = PTR_ERR(pwrseq);
>                 goto err;
>         }
>
> --
> 2.1.4
>
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" 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/pwrseq.c b/drivers/mmc/core/pwrseq.c
index ab2129781161..4c1d1757dbf9 100644
--- a/drivers/mmc/core/pwrseq.c
+++ b/drivers/mmc/core/pwrseq.c
@@ -73,7 +73,7 @@  int mmc_pwrseq_alloc(struct mmc_host *host)
 
 	pwrseq = match->alloc(host, &pdev->dev);
 	if (IS_ERR(pwrseq)) {
-		ret = PTR_ERR(host->pwrseq);
+		ret = PTR_ERR(pwrseq);
 		goto err;
 	}