From 636efbc66452659840a9a4df1daf80074ee439f6 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 13 Apr 2015 16:07:41 +0200 Subject: [PATCH] mmc: pwrseq: Fix error code propagation in mmc_pwrseq_simple_alloc() 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 Reviewed-by: Alexandre Courbot Signed-off-by: Ulf Hansson --- 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; }