Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Laurent Pinchart and committed by
Ulf Hansson
3df5b281 39ab1962

+3 -10
+3 -10
drivers/mmc/host/sdhci-pxav3.c
··· 288 288 int ret; 289 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 292 if (!pxa) 293 293 return -ENOMEM; 294 294 295 295 host = sdhci_pltfm_init(pdev, &sdhci_pxav3_pdata, 0); 296 - if (IS_ERR(host)) { 297 - kfree(pxa); 296 + if (IS_ERR(host)) 298 297 return PTR_ERR(host); 299 - } 300 298 301 299 if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) { 302 300 ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info()); ··· 306 308 pltfm_host = sdhci_priv(host); 307 309 pltfm_host->priv = pxa; 308 310 309 - clk = clk_get(dev, NULL); 311 + clk = devm_clk_get(dev, NULL); 310 312 if (IS_ERR(clk)) { 311 313 dev_err(dev, "failed to get io clock\n"); 312 314 ret = PTR_ERR(clk); ··· 387 389 pm_runtime_put_sync(&pdev->dev); 388 390 pm_runtime_disable(&pdev->dev); 389 391 clk_disable_unprepare(clk); 390 - clk_put(clk); 391 392 err_clk_get: 392 393 err_mbus_win: 393 394 sdhci_pltfm_free(pdev); 394 - kfree(pxa); 395 395 return ret; 396 396 } 397 397 ··· 397 401 { 398 402 struct sdhci_host *host = platform_get_drvdata(pdev); 399 403 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 400 - struct sdhci_pxa *pxa = pltfm_host->priv; 401 404 402 405 pm_runtime_get_sync(&pdev->dev); 403 406 sdhci_remove_host(host, 1); 404 407 pm_runtime_disable(&pdev->dev); 405 408 406 409 clk_disable_unprepare(pltfm_host->clk); 407 - clk_put(pltfm_host->clk); 408 410 409 411 sdhci_pltfm_free(pdev); 410 - kfree(pxa); 411 412 412 413 return 0; 413 414 }