All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] mmc: pwrseq: Fix error code propagation in mmc_pwrseq_simple_alloc()
@ 2015-04-13 14:07 Javier Martinez Canillas
  2015-04-14  2:00   ` Alexandre Courbot
  2015-04-14  9:20 ` Ulf Hansson
  0 siblings, 2 replies; 4+ messages in thread
From: Javier Martinez Canillas @ 2015-04-13 14:07 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Alexandre Courbot, Marek Szyprowski, Olof Johansson,
	Doug Anderson, Kevin Hilman, linux-mmc, linux-kernel,
	linux-samsung-soc, Javier Martinez Canillas

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(-)

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] mmc: pwrseq: Fix error code propagation in mmc_pwrseq_simple_alloc()
  2015-04-13 14:07 [PATCH 1/1] mmc: pwrseq: Fix error code propagation in mmc_pwrseq_simple_alloc() Javier Martinez Canillas
@ 2015-04-14  2:00   ` Alexandre Courbot
  2015-04-14  9:20 ` Ulf Hansson
  1 sibling, 0 replies; 4+ messages in thread
From: Alexandre Courbot @ 2015-04-14  2:00 UTC (permalink / raw)
  To: Javier Martinez Canillas, Ulf Hansson
  Cc: Marek Szyprowski, Olof Johansson, Doug Anderson, Kevin Hilman,
	linux-mmc, linux-kernel, linux-samsung-soc

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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] mmc: pwrseq: Fix error code propagation in mmc_pwrseq_simple_alloc()
@ 2015-04-14  2:00   ` Alexandre Courbot
  0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Courbot @ 2015-04-14  2:00 UTC (permalink / raw)
  To: Javier Martinez Canillas, Ulf Hansson
  Cc: Marek Szyprowski, Olof Johansson, Doug Anderson, Kevin Hilman,
	linux-mmc, linux-kernel, linux-samsung-soc

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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] mmc: pwrseq: Fix error code propagation in mmc_pwrseq_simple_alloc()
  2015-04-13 14:07 [PATCH 1/1] mmc: pwrseq: Fix error code propagation in mmc_pwrseq_simple_alloc() Javier Martinez Canillas
  2015-04-14  2:00   ` Alexandre Courbot
@ 2015-04-14  9:20 ` Ulf Hansson
  1 sibling, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2015-04-14  9:20 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: Alexandre Courbot, Marek Szyprowski, Olof Johansson,
	Doug Anderson, Kevin Hilman, linux-mmc, linux-kernel,
	linux-samsung-soc

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
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-04-14  9:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-13 14:07 [PATCH 1/1] mmc: pwrseq: Fix error code propagation in mmc_pwrseq_simple_alloc() Javier Martinez Canillas
2015-04-14  2:00 ` Alexandre Courbot
2015-04-14  2:00   ` Alexandre Courbot
2015-04-14  9:20 ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.