Commit 142dbab9 authored by Russell King's avatar Russell King Committed by Chris Ball

mmc: sdhci-spear: fix error handling paths for DT

Fix the error handling paths for DT and simplify using the devm_* API
for clk_get().
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: default avatarChris Ball <chris@printf.net>
parent 4025ce24
...@@ -129,7 +129,7 @@ static int sdhci_probe(struct platform_device *pdev) ...@@ -129,7 +129,7 @@ static int sdhci_probe(struct platform_device *pdev)
} }
/* clk enable */ /* clk enable */
sdhci->clk = clk_get(&pdev->dev, NULL); sdhci->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(sdhci->clk)) { if (IS_ERR(sdhci->clk)) {
ret = PTR_ERR(sdhci->clk); ret = PTR_ERR(sdhci->clk);
dev_dbg(&pdev->dev, "Error getting clock\n"); dev_dbg(&pdev->dev, "Error getting clock\n");
...@@ -139,7 +139,7 @@ static int sdhci_probe(struct platform_device *pdev) ...@@ -139,7 +139,7 @@ static int sdhci_probe(struct platform_device *pdev)
ret = clk_prepare_enable(sdhci->clk); ret = clk_prepare_enable(sdhci->clk);
if (ret) { if (ret) {
dev_dbg(&pdev->dev, "Error enabling clock\n"); dev_dbg(&pdev->dev, "Error enabling clock\n");
goto put_clk; goto err;
} }
ret = clk_set_rate(sdhci->clk, 50000000); ret = clk_set_rate(sdhci->clk, 50000000);
...@@ -151,7 +151,7 @@ static int sdhci_probe(struct platform_device *pdev) ...@@ -151,7 +151,7 @@ static int sdhci_probe(struct platform_device *pdev)
sdhci->data = sdhci_probe_config_dt(pdev); sdhci->data = sdhci_probe_config_dt(pdev);
if (IS_ERR(sdhci->data)) { if (IS_ERR(sdhci->data)) {
dev_err(&pdev->dev, "DT: Failed to get pdata\n"); dev_err(&pdev->dev, "DT: Failed to get pdata\n");
return -ENODEV; goto disable_clk;
} }
} else { } else {
sdhci->data = dev_get_platdata(&pdev->dev); sdhci->data = dev_get_platdata(&pdev->dev);
...@@ -261,8 +261,6 @@ static int sdhci_probe(struct platform_device *pdev) ...@@ -261,8 +261,6 @@ static int sdhci_probe(struct platform_device *pdev)
sdhci_free_host(host); sdhci_free_host(host);
disable_clk: disable_clk:
clk_disable_unprepare(sdhci->clk); clk_disable_unprepare(sdhci->clk);
put_clk:
clk_put(sdhci->clk);
err: err:
dev_err(&pdev->dev, "spear-sdhci probe failed: %d\n", ret); dev_err(&pdev->dev, "spear-sdhci probe failed: %d\n", ret);
return ret; return ret;
...@@ -282,7 +280,6 @@ static int sdhci_remove(struct platform_device *pdev) ...@@ -282,7 +280,6 @@ static int sdhci_remove(struct platform_device *pdev)
sdhci_remove_host(host, dead); sdhci_remove_host(host, dead);
sdhci_free_host(host); sdhci_free_host(host);
clk_disable_unprepare(sdhci->clk); clk_disable_unprepare(sdhci->clk);
clk_put(sdhci->clk);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment