Skip to content

Commit b6c90da

Browse files
ahunter6Ulf Hansson
authored andcommitted
mmc: sdhci-brcmstb: Use sdhci_pltfm_remove()
Use sdhci_pltfm_remove() instead of sdhci_pltfm_unregister() so that devm_clk_get_optional_enabled() can be used for pltfm_host->clk. This has the side effect that the order of operations on the error path and remove path is not the same as it was before, but should be safe nevertheless. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230811130351.7038-4-adrian.hunter@intel.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 8ebb607 commit b6c90da

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

drivers/mmc/host/sdhci-brcmstb.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -264,23 +264,17 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev)
264264

265265
dev_dbg(&pdev->dev, "Probe found match for %s\n", match->compatible);
266266

267-
clk = devm_clk_get_optional(&pdev->dev, NULL);
267+
clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
268268
if (IS_ERR(clk))
269269
return dev_err_probe(&pdev->dev, PTR_ERR(clk),
270-
"Failed to get clock from Device Tree\n");
271-
272-
res = clk_prepare_enable(clk);
273-
if (res)
274-
return res;
270+
"Failed to get and enable clock from Device Tree\n");
275271

276272
memset(&brcmstb_pdata, 0, sizeof(brcmstb_pdata));
277273
brcmstb_pdata.ops = match_priv->ops;
278274
host = sdhci_pltfm_init(pdev, &brcmstb_pdata,
279275
sizeof(struct sdhci_brcmstb_priv));
280-
if (IS_ERR(host)) {
281-
res = PTR_ERR(host);
282-
goto err_clk;
283-
}
276+
if (IS_ERR(host))
277+
return PTR_ERR(host);
284278

285279
pltfm_host = sdhci_priv(host);
286280
priv = sdhci_pltfm_priv(pltfm_host);
@@ -369,9 +363,7 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev)
369363

370364
err:
371365
sdhci_pltfm_free(pdev);
372-
err_clk:
373366
clk_disable_unprepare(base_clk);
374-
clk_disable_unprepare(clk);
375367
return res;
376368
}
377369

@@ -430,7 +422,7 @@ static struct platform_driver sdhci_brcmstb_driver = {
430422
.of_match_table = of_match_ptr(sdhci_brcm_of_match),
431423
},
432424
.probe = sdhci_brcmstb_probe,
433-
.remove_new = sdhci_pltfm_unregister,
425+
.remove_new = sdhci_pltfm_remove,
434426
.shutdown = sdhci_brcmstb_shutdown,
435427
};
436428

0 commit comments

Comments
 (0)