summaryrefslogtreecommitdiff
path: root/drivers/mmc/host/mxcmmc.c
diff options
context:
space:
mode:
authorArvind Yadav <arvind.yadav.cs@gmail.com>2017-08-08 08:57:43 +0300
committerUlf Hansson <ulf.hansson@linaro.org>2017-08-30 15:01:55 +0300
commita2bc74cfee87bdf0f656ada0e5deed6237f31eaf (patch)
tree12516c47dab4bdc566719168837c8340e16774c5 /drivers/mmc/host/mxcmmc.c
parent78bb1fd7f15066ee300fa5adf3af005f4b7a365c (diff)
downloadlinux-a2bc74cfee87bdf0f656ada0e5deed6237f31eaf.tar.xz
mmc: mxcmmc: Handle return value of clk_prepare_enable
clk_prepare_enable() can fail here and we must check its return value. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host/mxcmmc.c')
-rw-r--r--drivers/mmc/host/mxcmmc.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index f2b6639634d2..1d5418e4efae 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -1103,8 +1103,13 @@ static int mxcmci_probe(struct platform_device *pdev)
goto out_free;
}
- clk_prepare_enable(host->clk_per);
- clk_prepare_enable(host->clk_ipg);
+ ret = clk_prepare_enable(host->clk_per);
+ if (ret)
+ goto out_free;
+
+ ret = clk_prepare_enable(host->clk_ipg);
+ if (ret)
+ goto out_clk_per_put;
mxcmci_softreset(host);
@@ -1173,8 +1178,9 @@ out_free_dma:
dma_release_channel(host->dma);
out_clk_put:
- clk_disable_unprepare(host->clk_per);
clk_disable_unprepare(host->clk_ipg);
+out_clk_per_put:
+ clk_disable_unprepare(host->clk_per);
out_free:
mmc_free_host(mmc);
@@ -1217,10 +1223,17 @@ static int __maybe_unused mxcmci_resume(struct device *dev)
{
struct mmc_host *mmc = dev_get_drvdata(dev);
struct mxcmci_host *host = mmc_priv(mmc);
+ int ret;
- clk_prepare_enable(host->clk_per);
- clk_prepare_enable(host->clk_ipg);
- return 0;
+ ret = clk_prepare_enable(host->clk_per);
+ if (ret)
+ return ret;
+
+ ret = clk_prepare_enable(host->clk_ipg);
+ if (ret)
+ clk_disable_unprepare(host->clk_per);
+
+ return ret;
}
static SIMPLE_DEV_PM_OPS(mxcmci_pm_ops, mxcmci_suspend, mxcmci_resume);