Commit 3df5b281 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Ulf Hansson

mmc: sdhci-pxav3: Use devm_* managed helpers

This simplifies probe error and remove code paths.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 39ab1962
...@@ -288,15 +288,13 @@ static int sdhci_pxav3_probe(struct platform_device *pdev) ...@@ -288,15 +288,13 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
int ret; int ret;
struct clk *clk; struct clk *clk;
pxa = kzalloc(sizeof(struct sdhci_pxa), GFP_KERNEL); pxa = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_pxa), GFP_KERNEL);
if (!pxa) if (!pxa)
return -ENOMEM; return -ENOMEM;
host = sdhci_pltfm_init(pdev, &sdhci_pxav3_pdata, 0); host = sdhci_pltfm_init(pdev, &sdhci_pxav3_pdata, 0);
if (IS_ERR(host)) { if (IS_ERR(host))
kfree(pxa);
return PTR_ERR(host); return PTR_ERR(host);
}
if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) { if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) {
ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info()); ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info());
...@@ -308,7 +306,7 @@ static int sdhci_pxav3_probe(struct platform_device *pdev) ...@@ -308,7 +306,7 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
pltfm_host = sdhci_priv(host); pltfm_host = sdhci_priv(host);
pltfm_host->priv = pxa; pltfm_host->priv = pxa;
clk = clk_get(dev, NULL); clk = devm_clk_get(dev, NULL);
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
dev_err(dev, "failed to get io clock\n"); dev_err(dev, "failed to get io clock\n");
ret = PTR_ERR(clk); ret = PTR_ERR(clk);
...@@ -389,11 +387,9 @@ static int sdhci_pxav3_probe(struct platform_device *pdev) ...@@ -389,11 +387,9 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
pm_runtime_put_sync(&pdev->dev); pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
clk_disable_unprepare(clk); clk_disable_unprepare(clk);
clk_put(clk);
err_clk_get: err_clk_get:
err_mbus_win: err_mbus_win:
sdhci_pltfm_free(pdev); sdhci_pltfm_free(pdev);
kfree(pxa);
return ret; return ret;
} }
...@@ -401,17 +397,14 @@ static int sdhci_pxav3_remove(struct platform_device *pdev) ...@@ -401,17 +397,14 @@ static int sdhci_pxav3_remove(struct platform_device *pdev)
{ {
struct sdhci_host *host = platform_get_drvdata(pdev); struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
struct sdhci_pxa *pxa = pltfm_host->priv;
pm_runtime_get_sync(&pdev->dev); pm_runtime_get_sync(&pdev->dev);
sdhci_remove_host(host, 1); sdhci_remove_host(host, 1);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
clk_disable_unprepare(pltfm_host->clk); clk_disable_unprepare(pltfm_host->clk);
clk_put(pltfm_host->clk);
sdhci_pltfm_free(pdev); sdhci_pltfm_free(pdev);
kfree(pxa);
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