aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2014-07-16 05:53:42 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2014-08-11 02:53:04 -0400
commit3df5b28149df5c04f0fbb4efe15ef870ce93de93 (patch)
tree04b22bffe17341e4f9b0361c64c62f71f08b33e9 /drivers/mmc
parent39ab196243e8732ad68928be97129305b29afbbd (diff)
mmc: sdhci-pxav3: Use devm_* managed helpers
This simplifies probe error and remove code paths. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/sdhci-pxav3.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index f4f128947561..6f842fb8e6b8 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -288,15 +288,13 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
288 int ret; 288 int ret;
289 struct clk *clk; 289 struct clk *clk;
290 290
291 pxa = kzalloc(sizeof(struct sdhci_pxa), GFP_KERNEL); 291 pxa = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_pxa), GFP_KERNEL);
292 if (!pxa) 292 if (!pxa)
293 return -ENOMEM; 293 return -ENOMEM;
294 294
295 host = sdhci_pltfm_init(pdev, &sdhci_pxav3_pdata, 0); 295 host = sdhci_pltfm_init(pdev, &sdhci_pxav3_pdata, 0);
296 if (IS_ERR(host)) { 296 if (IS_ERR(host))
297 kfree(pxa);
298 return PTR_ERR(host); 297 return PTR_ERR(host);
299 }
300 298
301 if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) { 299 if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) {
302 ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info()); 300 ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info());
@@ -308,7 +306,7 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
308 pltfm_host = sdhci_priv(host); 306 pltfm_host = sdhci_priv(host);
309 pltfm_host->priv = pxa; 307 pltfm_host->priv = pxa;
310 308
311 clk = clk_get(dev, NULL); 309 clk = devm_clk_get(dev, NULL);
312 if (IS_ERR(clk)) { 310 if (IS_ERR(clk)) {
313 dev_err(dev, "failed to get io clock\n"); 311 dev_err(dev, "failed to get io clock\n");
314 ret = PTR_ERR(clk); 312 ret = PTR_ERR(clk);
@@ -389,11 +387,9 @@ err_add_host:
389 pm_runtime_put_sync(&pdev->dev); 387 pm_runtime_put_sync(&pdev->dev);
390 pm_runtime_disable(&pdev->dev); 388 pm_runtime_disable(&pdev->dev);
391 clk_disable_unprepare(clk); 389 clk_disable_unprepare(clk);
392 clk_put(clk);
393err_clk_get: 390err_clk_get:
394err_mbus_win: 391err_mbus_win:
395 sdhci_pltfm_free(pdev); 392 sdhci_pltfm_free(pdev);
396 kfree(pxa);
397 return ret; 393 return ret;
398} 394}
399 395
@@ -401,17 +397,14 @@ static int sdhci_pxav3_remove(struct platform_device *pdev)
401{ 397{
402 struct sdhci_host *host = platform_get_drvdata(pdev); 398 struct sdhci_host *host = platform_get_drvdata(pdev);
403 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 399 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
404 struct sdhci_pxa *pxa = pltfm_host->priv;
405 400
406 pm_runtime_get_sync(&pdev->dev); 401 pm_runtime_get_sync(&pdev->dev);
407 sdhci_remove_host(host, 1); 402 sdhci_remove_host(host, 1);
408 pm_runtime_disable(&pdev->dev); 403 pm_runtime_disable(&pdev->dev);
409 404
410 clk_disable_unprepare(pltfm_host->clk); 405 clk_disable_unprepare(pltfm_host->clk);
411 clk_put(pltfm_host->clk);
412 406
413 sdhci_pltfm_free(pdev); 407 sdhci_pltfm_free(pdev);
414 kfree(pxa);
415 408
416 return 0; 409 return 0;
417} 410}