aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Griffin <peter.griffin@linaro.org>2016-09-07 11:24:02 +0100
committerPeter Griffin <peter.griffin@linaro.org>2016-09-07 14:05:47 +0100
commit814a9180a675542d6b4a4286607717460b57ece5 (patch)
tree785f4b4b882dc85ac2b616c502ee12a60fe10a55
parent4d15221e96f127b1f862fc49cc7a88171dd16aba (diff)
mmc: sdhci-st: ensure icnclk gets assigned to pdatafor-lee-b2260-mmc-usb-fix
icnclk is optional so it needs to check for error condition to avoid kernel ops in clk_* functions. It also needs to be assigned to pdata to work correctly. Additionally remove clk_disable_unprepare() from remove() which is done by sdhci_pltfm_unregister(). Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
-rw-r--r--drivers/mmc/host/sdhci-st.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/mmc/host/sdhci-st.c b/drivers/mmc/host/sdhci-st.c
index 8f0152431730..f520d0c77840 100644
--- a/drivers/mmc/host/sdhci-st.c
+++ b/drivers/mmc/host/sdhci-st.c
@@ -354,7 +354,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
struct sdhci_host *host;
struct st_mmc_platform_data *pdata;
struct sdhci_pltfm_host *pltfm_host;
- struct clk *clk, *icnclk;
+ struct clk *clk;
int ret = 0;
u16 host_version;
struct resource *res;
@@ -366,9 +366,6 @@ static int sdhci_st_probe(struct platform_device *pdev)
return PTR_ERR(clk);
}
- /* ICN clock isn't compulsory, but use it if it's provided. */
- icnclk = devm_clk_get(&pdev->dev, "icn");
-
rstc = devm_reset_control_get(&pdev->dev, NULL);
if (IS_ERR(rstc))
rstc = NULL;
@@ -392,8 +389,13 @@ static int sdhci_st_probe(struct platform_device *pdev)
goto err_of;
}
+ /* ICN clock isn't compulsory, but use it if it's provided. */
+ pdata->icnclk = devm_clk_get(&pdev->dev, "icn");
+ if (IS_ERR(pdata->icnclk))
+ pdata->icnclk = NULL;
+
clk_prepare_enable(clk);
- clk_prepare_enable(icnclk);
+ clk_prepare_enable(pdata->icnclk);
/* Configure the FlashSS Top registers for setting eMMC TX/RX delay */
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
@@ -427,7 +429,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
return 0;
err_out:
- clk_disable_unprepare(icnclk);
+ clk_disable_unprepare(pdata->icnclk);
clk_disable_unprepare(clk);
err_of:
sdhci_pltfm_free(pdev);
@@ -446,11 +448,10 @@ static int sdhci_st_remove(struct platform_device *pdev)
struct reset_control *rstc = pdata->rstc;
int ret;
- clk_disable_unprepare(pdata->icnclk);
- clk_disable_unprepare(pltfm_host->clk);
-
ret = sdhci_pltfm_unregister(pdev);
+ clk_disable_unprepare(pdata->icnclk);
+
if (rstc)
reset_control_assert(rstc);