Commit 46991005 authored by Ben Dooks's avatar Ben Dooks Committed by Ulf Hansson

mmc: sh-mmcif: use devm_ for clock management

Use the devm_clk_get() code to get the clock and allow it to be freed
automatically on release.
Signed-off-by: default avatarBen Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 18f55fcc
...@@ -1390,7 +1390,7 @@ static int sh_mmcif_probe(struct platform_device *pdev) ...@@ -1390,7 +1390,7 @@ static int sh_mmcif_probe(struct platform_device *pdev)
ret = mmc_of_parse(mmc); ret = mmc_of_parse(mmc);
if (ret < 0) if (ret < 0)
goto eofparse; goto err_host;
host = mmc_priv(mmc); host = mmc_priv(mmc);
host->mmc = mmc; host->mmc = mmc;
...@@ -1420,19 +1420,19 @@ static int sh_mmcif_probe(struct platform_device *pdev) ...@@ -1420,19 +1420,19 @@ static int sh_mmcif_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
host->power = false; host->power = false;
host->hclk = clk_get(&pdev->dev, NULL); host->hclk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(host->hclk)) { if (IS_ERR(host->hclk)) {
ret = PTR_ERR(host->hclk); ret = PTR_ERR(host->hclk);
dev_err(&pdev->dev, "cannot get clock: %d\n", ret); dev_err(&pdev->dev, "cannot get clock: %d\n", ret);
goto eclkget; goto err_pm;
} }
ret = sh_mmcif_clk_update(host); ret = sh_mmcif_clk_update(host);
if (ret < 0) if (ret < 0)
goto eclkupdate; goto err_pm;
ret = pm_runtime_resume(&pdev->dev); ret = pm_runtime_resume(&pdev->dev);
if (ret < 0) if (ret < 0)
goto eresume; goto err_clk;
INIT_DELAYED_WORK(&host->timeout_work, mmcif_timeout_work); INIT_DELAYED_WORK(&host->timeout_work, mmcif_timeout_work);
...@@ -1483,13 +1483,11 @@ static int sh_mmcif_probe(struct platform_device *pdev) ...@@ -1483,13 +1483,11 @@ static int sh_mmcif_probe(struct platform_device *pdev)
free_irq(irq[0], host); free_irq(irq[0], host);
ereqirq0: ereqirq0:
pm_runtime_suspend(&pdev->dev); pm_runtime_suspend(&pdev->dev);
eresume: err_clk:
clk_disable_unprepare(host->hclk); clk_disable_unprepare(host->hclk);
eclkupdate: err_pm:
clk_put(host->hclk);
eclkget:
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
eofparse: err_host:
mmc_free_host(mmc); mmc_free_host(mmc);
return ret; return ret;
} }
......
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