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

mmc: sdhci-cadence: Use sdhci_pltfm_remove()

Use sdhci_pltfm_remove() instead of sdhci_pltfm_unregister() so that
devm_clk_get_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-5-adrian.hunter@intel.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Adrian Hunter and committed by
Ulf Hansson
6996beab b6c90da3

+4 -13
+4 -13
drivers/mmc/host/sdhci-cadence.c
··· 487 487 struct device *dev = &pdev->dev; 488 488 static const u16 version = SDHCI_SPEC_400 << SDHCI_SPEC_VER_SHIFT; 489 489 490 - clk = devm_clk_get(dev, NULL); 490 + clk = devm_clk_get_enabled(dev, NULL); 491 491 if (IS_ERR(clk)) 492 492 return PTR_ERR(clk); 493 - 494 - ret = clk_prepare_enable(clk); 495 - if (ret) 496 - return ret; 497 493 498 494 data = of_device_get_match_data(dev); 499 495 if (!data) ··· 498 502 nr_phy_params = sdhci_cdns_phy_param_count(dev->of_node); 499 503 host = sdhci_pltfm_init(pdev, &data->pltfm_data, 500 504 struct_size(priv, phy_params, nr_phy_params)); 501 - if (IS_ERR(host)) { 502 - ret = PTR_ERR(host); 503 - goto disable_clk; 504 - } 505 + if (IS_ERR(host)) 506 + return PTR_ERR(host); 505 507 506 508 pltfm_host = sdhci_priv(host); 507 509 pltfm_host->clk = clk; ··· 550 556 return 0; 551 557 free: 552 558 sdhci_pltfm_free(pdev); 553 - disable_clk: 554 - clk_disable_unprepare(clk); 555 - 556 559 return ret; 557 560 } 558 561 ··· 608 617 .of_match_table = sdhci_cdns_match, 609 618 }, 610 619 .probe = sdhci_cdns_probe, 611 - .remove_new = sdhci_pltfm_unregister, 620 + .remove_new = sdhci_pltfm_remove, 612 621 }; 613 622 module_platform_driver(sdhci_cdns_driver); 614 623