mmc: wmt-sdmmc: Handle return value of clk_prepare_enable
authorArvind Yadav <arvind.yadav.cs@gmail.com>
Tue, 8 Aug 2017 05:46:38 +0000 (11:16 +0530)
committerUlf Hansson <ulf.hansson@linaro.org>
Wed, 30 Aug 2017 12:01:55 +0000 (14:01 +0200)
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>
drivers/mmc/host/wmt-sdmmc.c

index 50fe69d9b85d2e0d0bbc0517c2ac8dd48c2edb04..fd30ac7da5e5f65636779c04587840a8f0ce8a66 100644 (file)
@@ -856,7 +856,9 @@ static int wmt_mci_probe(struct platform_device *pdev)
                goto fail5;
        }
 
-       clk_prepare_enable(priv->clk_sdmmc);
+       ret = clk_prepare_enable(priv->clk_sdmmc);
+       if (ret)
+               goto fail6;
 
        /* configure the controller to a known 'ready' state */
        wmt_reset_hardware(mmc);
@@ -866,6 +868,8 @@ static int wmt_mci_probe(struct platform_device *pdev)
        dev_info(&pdev->dev, "WMT SDHC Controller initialized\n");
 
        return 0;
+fail6:
+       clk_put(priv->clk_sdmmc);
 fail5:
        free_irq(dma_irq, priv);
 fail4: