linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage
@ 2025-05-29 12:56 Binbin Zhou
  2025-05-29 12:57 ` [PATCH v2 01/35] mmc: sdhci: Use devm_mmc_alloc_host() helper Binbin Zhou
                   ` (34 more replies)
  0 siblings, 35 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 12:56 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Taichi Sugaya,
	Takao Orito, Ben Dooks, Jaehoon Chung, Florian Fainelli, Ray Jui,
	Scott Branden, Kamal Dasu, Al Cooper, Haibo Chen, Shawn Guo,
	Sascha Hauer, Fabio Estevam, imx, Avi Fishman, Tomer Maimon,
	Tali Perry, Patrick Venture, Nancy Yuen, Benjamin Fair, openbmc,
	Michal Simek, Joel Stanley, linux-aspeed, Aubin Constans,
	Eugen Hristev, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
	Yixun Lan, linux-riscv, spacemit, Jacky Huang, Shan-Chun Hung,
	Steen Hegelund, Daniel Machon, Vignesh Raghavendra,
	Patrice Chotard, Thierry Reding, Jonathan Hunter, linux-tegra,
	Hu Ziji, Binbin Zhou

Hi all:

After the first part of the cleanup[1], there are sdhci related
drivers that need further cleanup.

This patchset is the second part of the cleanup series, and since sdhci has
sdhci_alloc_host() as the general interface, our main job is to clean up
sdhci_pltfm_free() and sdhci_free_host().

[1]:https://lore.kernel.org/all/cover.1747877175.git.zhoubinbin@loongson.cn/

Thanks.

-----
V2:
- Collect Reviewed-by and Acked-by tags.
Patch-01:
 - Set sdhci_free_host() to empty, rather than dropping it.
Patch-07:
 - Set sdhci_pltfm_free() to empty, rather than dropping it.
Patch-22:
 - As requested by Yixun, keep the goto scheme.
Patch-35:
 - New patch;
 - Since all calls have been cleaned up, sdhci_pltfm_free()/sdhci_free_host()
   are now dropped directly;

Link to V1:
https://lore.kernel.org/all/cover.1747792905.git.zhoubinbin@loongson.cn/

Binbin Zhou (35):
  mmc: sdhci: Use devm_mmc_alloc_host() helper
  mmc: sdhci-acpi: Drop the use of sdhci_free_host()
  mmc: sdhci-milbeaut: Drop the use of sdhci_free_host()
  mmc: sdhci-pci: Drop the use of sdhci_free_host()
  mmc: sdhci-s3c: Drop the use of sdhci_free_host()
  mmc: sdhci-spear: Drop the use of sdhci_free_host()
  mmc: sdhci-pltfm: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-bcm-kona: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-brcmstb: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-cadence: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-dove: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-esdhc-imx: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-esdhc-mcf: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-iproc: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-msm: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-npcm: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-of-arasan: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-of-aspeed: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-of-at91: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-of-dwcmshc: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-of-esdhc: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-of-k1: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-of-ma35d1: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-of-sparx5: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-omap: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-pic32: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-pxav2: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-pxav3: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-sprd: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-st: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-tegra: Drop the use of sdhci_pltfm_free()
  mmc: sdhci-xenon: Drop the use of sdhci_pltfm_free()
  mmc: sdhci_am654: Drop the use of sdhci_pltfm_free()
  mmc: sdhci_f_sdh30: Drop the use of sdhci_pltfm_free()
  mmc: sdhci: Drop sdhci_free_host()/sdhci_pltfm_free() definitions

 drivers/mmc/host/sdhci-acpi.c       |  3 ---
 drivers/mmc/host/sdhci-bcm-kona.c   |  2 --
 drivers/mmc/host/sdhci-brcmstb.c    |  1 -
 drivers/mmc/host/sdhci-cadence.c    | 21 ++++++------------
 drivers/mmc/host/sdhci-dove.c       | 12 ++---------
 drivers/mmc/host/sdhci-esdhc-imx.c  |  3 ---
 drivers/mmc/host/sdhci-esdhc-mcf.c  | 25 ++++++----------------
 drivers/mmc/host/sdhci-iproc.c      | 18 ++++------------
 drivers/mmc/host/sdhci-milbeaut.c   | 19 ++++++-----------
 drivers/mmc/host/sdhci-msm.c        | 11 ++++------
 drivers/mmc/host/sdhci-npcm.c       | 15 +++----------
 drivers/mmc/host/sdhci-of-arasan.c  | 26 +++++++----------------
 drivers/mmc/host/sdhci-of-aspeed.c  | 10 ++-------
 drivers/mmc/host/sdhci-of-at91.c    | 23 +++++++-------------
 drivers/mmc/host/sdhci-of-dwcmshc.c | 14 +++++-------
 drivers/mmc/host/sdhci-of-esdhc.c   | 11 ++--------
 drivers/mmc/host/sdhci-of-k1.c      |  1 -
 drivers/mmc/host/sdhci-of-ma35d1.c  | 23 +++++++-------------
 drivers/mmc/host/sdhci-of-sparx5.c  | 24 +++++++--------------
 drivers/mmc/host/sdhci-omap.c       | 21 ++++++------------
 drivers/mmc/host/sdhci-pci-core.c   |  9 ++------
 drivers/mmc/host/sdhci-pic32.c      |  9 +++-----
 drivers/mmc/host/sdhci-pltfm.c      | 16 +-------------
 drivers/mmc/host/sdhci-pltfm.h      |  1 -
 drivers/mmc/host/sdhci-pxav2.c      | 26 ++++++-----------------
 drivers/mmc/host/sdhci-pxav3.c      |  7 +-----
 drivers/mmc/host/sdhci-s3c.c        | 16 ++++----------
 drivers/mmc/host/sdhci-spear.c      | 11 ++++------
 drivers/mmc/host/sdhci-sprd.c       | 33 +++++++++--------------------
 drivers/mmc/host/sdhci-st.c         |  6 ++----
 drivers/mmc/host/sdhci-tegra.c      |  9 +++-----
 drivers/mmc/host/sdhci-xenon.c      |  9 ++------
 drivers/mmc/host/sdhci.c            |  9 +-------
 drivers/mmc/host/sdhci.h            |  1 -
 drivers/mmc/host/sdhci_am654.c      | 20 ++++++-----------
 drivers/mmc/host/sdhci_f_sdh30.c    | 13 ++++--------
 36 files changed, 129 insertions(+), 349 deletions(-)


base-commit: d2c6acff6386f43ed307822454b970c831c48f1b
-- 
2.47.1


^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH v2 01/35] mmc: sdhci: Use devm_mmc_alloc_host() helper
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
@ 2025-05-29 12:57 ` Binbin Zhou
  2025-05-29 12:58 ` [PATCH v2 02/35] mmc: sdhci-acpi: Drop the use of sdhci_free_host() Binbin Zhou
                   ` (33 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 12:57 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Taichi Sugaya,
	Takao Orito, Ben Dooks, Jaehoon Chung, Florian Fainelli, Ray Jui,
	Scott Branden, Kamal Dasu, Al Cooper, Haibo Chen, Shawn Guo,
	Sascha Hauer, Fabio Estevam, imx, Avi Fishman, Tomer Maimon,
	Tali Perry, Patrick Venture, Nancy Yuen, Benjamin Fair, openbmc,
	Michal Simek, Joel Stanley, linux-aspeed, Aubin Constans,
	Eugen Hristev, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
	Yixun Lan, linux-riscv, spacemit, Jacky Huang, Shan-Chun Hung,
	Steen Hegelund, Daniel Machon, Vignesh Raghavendra,
	Patrice Chotard, Thierry Reding, Jonathan Hunter, linux-tegra,
	Hu Ziji, Binbin Zhou

Use new function devm_mmc_alloc_host() to simplify the code.

Although sdhci_free_host() is no longer needed, to avoid drivers that still
use this function from failing to compile, sdhci_free_host() is temporarily
set to empty. Finally, it will be removed when there are no more callers.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 32fa0b2bb912..ee5a5ae4db31 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -4076,7 +4076,7 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev,
 
 	WARN_ON(dev == NULL);
 
-	mmc = mmc_alloc_host(sizeof(struct sdhci_host) + priv_size, dev);
+	mmc = devm_mmc_alloc_host(dev, sizeof(struct sdhci_host) + priv_size);
 	if (!mmc)
 		return ERR_PTR(-ENOMEM);
 
@@ -5002,7 +5002,6 @@ EXPORT_SYMBOL_GPL(sdhci_remove_host);
 
 void sdhci_free_host(struct sdhci_host *host)
 {
-	mmc_free_host(host->mmc);
 }
 
 EXPORT_SYMBOL_GPL(sdhci_free_host);
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 02/35] mmc: sdhci-acpi: Drop the use of sdhci_free_host()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
  2025-05-29 12:57 ` [PATCH v2 01/35] mmc: sdhci: Use devm_mmc_alloc_host() helper Binbin Zhou
@ 2025-05-29 12:58 ` Binbin Zhou
  2025-05-29 12:58 ` [PATCH v2 03/35] mmc: sdhci-milbeaut: " Binbin Zhou
                   ` (32 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 12:58 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_free_host() is no longer needed.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-acpi.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index e6c5c82f64fa..1e38a881a859 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -948,7 +948,6 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
 	if (c->slot && c->slot->free_slot)
 		c->slot->free_slot(pdev);
 
-	sdhci_free_host(c->host);
 	return err;
 }
 
@@ -972,8 +971,6 @@ static void sdhci_acpi_remove(struct platform_device *pdev)
 
 	if (c->slot && c->slot->free_slot)
 		c->slot->free_slot(pdev);
-
-	sdhci_free_host(c->host);
 }
 
 static void __maybe_unused sdhci_acpi_reset_signal_voltage_if_needed(
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 03/35] mmc: sdhci-milbeaut: Drop the use of sdhci_free_host()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
  2025-05-29 12:57 ` [PATCH v2 01/35] mmc: sdhci: Use devm_mmc_alloc_host() helper Binbin Zhou
  2025-05-29 12:58 ` [PATCH v2 02/35] mmc: sdhci-acpi: Drop the use of sdhci_free_host() Binbin Zhou
@ 2025-05-29 12:58 ` Binbin Zhou
  2025-05-29 12:58 ` [PATCH v2 04/35] mmc: sdhci-pci: " Binbin Zhou
                   ` (31 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 12:58 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou,
	Taichi Sugaya, Takao Orito

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_free_host() is no longer needed.

Cc: Taichi Sugaya <sugaya.taichi@socionext.com>
Cc: Takao Orito <orito.takao@socionext.com>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-milbeaut.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/sdhci-milbeaut.c b/drivers/mmc/host/sdhci-milbeaut.c
index a4675456f9c7..bda71d5966dc 100644
--- a/drivers/mmc/host/sdhci-milbeaut.c
+++ b/drivers/mmc/host/sdhci-milbeaut.c
@@ -258,7 +258,7 @@ static int sdhci_milbeaut_probe(struct platform_device *pdev)
 
 	ret = mmc_of_parse(host->mmc);
 	if (ret)
-		goto err;
+		return ret;
 
 	platform_set_drvdata(pdev, host);
 
@@ -267,23 +267,19 @@ static int sdhci_milbeaut_probe(struct platform_device *pdev)
 	host->irq = irq;
 
 	host->ioaddr = devm_platform_ioremap_resource(pdev, 0);
-	if (IS_ERR(host->ioaddr)) {
-		ret = PTR_ERR(host->ioaddr);
-		goto err;
-	}
+	if (IS_ERR(host->ioaddr))
+		return PTR_ERR(host->ioaddr);
 
 	if (dev_of_node(dev)) {
 		sdhci_get_of_property(pdev);
 
 		priv->clk_iface = devm_clk_get(&pdev->dev, "iface");
-		if (IS_ERR(priv->clk_iface)) {
-			ret = PTR_ERR(priv->clk_iface);
-			goto err;
-		}
+		if (IS_ERR(priv->clk_iface))
+			return PTR_ERR(priv->clk_iface);
 
 		ret = clk_prepare_enable(priv->clk_iface);
 		if (ret)
-			goto err;
+			return ret;
 
 		priv->clk = devm_clk_get(&pdev->dev, "core");
 		if (IS_ERR(priv->clk)) {
@@ -308,8 +304,6 @@ static int sdhci_milbeaut_probe(struct platform_device *pdev)
 	clk_disable_unprepare(priv->clk);
 err_clk:
 	clk_disable_unprepare(priv->clk_iface);
-err:
-	sdhci_free_host(host);
 	return ret;
 }
 
@@ -324,7 +318,6 @@ static void sdhci_milbeaut_remove(struct platform_device *pdev)
 	clk_disable_unprepare(priv->clk_iface);
 	clk_disable_unprepare(priv->clk);
 
-	sdhci_free_host(host);
 	platform_set_drvdata(pdev, NULL);
 }
 
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 04/35] mmc: sdhci-pci: Drop the use of sdhci_free_host()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (2 preceding siblings ...)
  2025-05-29 12:58 ` [PATCH v2 03/35] mmc: sdhci-milbeaut: " Binbin Zhou
@ 2025-05-29 12:58 ` Binbin Zhou
  2025-05-29 12:58 ` [PATCH v2 05/35] mmc: sdhci-s3c: " Binbin Zhou
                   ` (30 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 12:58 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_free_host() is no longer needed.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-pci-core.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
index 13a84b9309e0..9f567b768c42 100644
--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -2173,7 +2173,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
 	ret = pcim_iomap_regions(pdev, BIT(bar), mmc_hostname(host->mmc));
 	if (ret) {
 		dev_err(&pdev->dev, "cannot request region\n");
-		goto cleanup;
+		return ERR_PTR(ret);
 	}
 
 	host->ioaddr = pcim_iomap_table(pdev)[bar];
@@ -2181,7 +2181,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
 	if (chip->fixes && chip->fixes->probe_slot) {
 		ret = chip->fixes->probe_slot(slot);
 		if (ret)
-			goto cleanup;
+			return ERR_PTR(ret);
 	}
 
 	host->mmc->pm_caps = MMC_PM_KEEP_POWER;
@@ -2242,9 +2242,6 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
 	if (chip->fixes && chip->fixes->remove_slot)
 		chip->fixes->remove_slot(slot, 0);
 
-cleanup:
-	sdhci_free_host(host);
-
 	return ERR_PTR(ret);
 }
 
@@ -2265,8 +2262,6 @@ static void sdhci_pci_remove_slot(struct sdhci_pci_slot *slot)
 
 	if (slot->chip->fixes && slot->chip->fixes->remove_slot)
 		slot->chip->fixes->remove_slot(slot, dead);
-
-	sdhci_free_host(slot->host);
 }
 
 int sdhci_pci_uhs2_add_host(struct sdhci_pci_slot *slot)
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 05/35] mmc: sdhci-s3c: Drop the use of sdhci_free_host()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (3 preceding siblings ...)
  2025-05-29 12:58 ` [PATCH v2 04/35] mmc: sdhci-pci: " Binbin Zhou
@ 2025-05-29 12:58 ` Binbin Zhou
  2025-05-29 12:58 ` [PATCH v2 06/35] mmc: sdhci-spear: " Binbin Zhou
                   ` (29 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 12:58 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou, Ben Dooks,
	Jaehoon Chung

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_free_host() is no longer needed.

Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-s3c.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index bdf4dc0d6b77..51d20d483acd 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -507,15 +507,13 @@ static int sdhci_s3c_probe(struct platform_device *pdev)
 	sc = sdhci_priv(host);
 
 	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
-	if (!pdata) {
-		ret = -ENOMEM;
-		goto err_pdata_io_clk;
-	}
+	if (!pdata)
+		return -ENOMEM;
 
 	if (pdev->dev.of_node) {
 		ret = sdhci_s3c_parse_dt(&pdev->dev, host, pdata);
 		if (ret)
-			goto err_pdata_io_clk;
+			return ret;
 	} else {
 		memcpy(pdata, pdev->dev.platform_data, sizeof(*pdata));
 	}
@@ -532,8 +530,7 @@ static int sdhci_s3c_probe(struct platform_device *pdev)
 	sc->clk_io = devm_clk_get(dev, "hsmmc");
 	if (IS_ERR(sc->clk_io)) {
 		dev_err(dev, "failed to get io clock\n");
-		ret = PTR_ERR(sc->clk_io);
-		goto err_pdata_io_clk;
+		return PTR_ERR(sc->clk_io);
 	}
 
 	/* enable the local io clock and keep it running for the moment. */
@@ -661,9 +658,6 @@ static int sdhci_s3c_probe(struct platform_device *pdev)
  err_no_busclks:
 	clk_disable_unprepare(sc->clk_io);
 
- err_pdata_io_clk:
-	sdhci_free_host(host);
-
 	return ret;
 }
 
@@ -685,8 +679,6 @@ static void sdhci_s3c_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 
 	clk_disable_unprepare(sc->clk_io);
-
-	sdhci_free_host(host);
 }
 
 #ifdef CONFIG_PM_SLEEP
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 06/35] mmc: sdhci-spear: Drop the use of sdhci_free_host()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (4 preceding siblings ...)
  2025-05-29 12:58 ` [PATCH v2 05/35] mmc: sdhci-s3c: " Binbin Zhou
@ 2025-05-29 12:58 ` Binbin Zhou
  2025-05-29 12:58 ` [PATCH v2 07/35] mmc: sdhci-pltfm: Drop the use of sdhci_pltfm_free() Binbin Zhou
                   ` (28 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 12:58 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_free_host() is no longer needed.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-spear.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c
index 770dc12b9ae9..fa0f8aeb7ee0 100644
--- a/drivers/mmc/host/sdhci-spear.c
+++ b/drivers/mmc/host/sdhci-spear.c
@@ -59,7 +59,7 @@ static int sdhci_probe(struct platform_device *pdev)
 	if (IS_ERR(host->ioaddr)) {
 		ret = PTR_ERR(host->ioaddr);
 		dev_dbg(&pdev->dev, "unable to map iomem: %d\n", ret);
-		goto err_host;
+		goto err;
 	}
 
 	host->hw_name = "sdhci";
@@ -67,7 +67,7 @@ static int sdhci_probe(struct platform_device *pdev)
 	host->irq = platform_get_irq(pdev, 0);
 	if (host->irq < 0) {
 		ret = host->irq;
-		goto err_host;
+		goto err;
 	}
 	host->quirks = SDHCI_QUIRK_BROKEN_ADMA;
 
@@ -78,13 +78,13 @@ static int sdhci_probe(struct platform_device *pdev)
 	if (IS_ERR(sdhci->clk)) {
 		ret = PTR_ERR(sdhci->clk);
 		dev_dbg(&pdev->dev, "Error getting clock\n");
-		goto err_host;
+		goto err;
 	}
 
 	ret = clk_prepare_enable(sdhci->clk);
 	if (ret) {
 		dev_dbg(&pdev->dev, "Error enabling clock\n");
-		goto err_host;
+		goto err;
 	}
 
 	ret = clk_set_rate(sdhci->clk, 50000000);
@@ -110,8 +110,6 @@ static int sdhci_probe(struct platform_device *pdev)
 
 disable_clk:
 	clk_disable_unprepare(sdhci->clk);
-err_host:
-	sdhci_free_host(host);
 err:
 	dev_err(&pdev->dev, "spear-sdhci probe failed: %d\n", ret);
 	return ret;
@@ -130,7 +128,6 @@ static void sdhci_remove(struct platform_device *pdev)
 
 	sdhci_remove_host(host, dead);
 	clk_disable_unprepare(sdhci->clk);
-	sdhci_free_host(host);
 }
 
 #ifdef CONFIG_PM_SLEEP
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 07/35] mmc: sdhci-pltfm: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (5 preceding siblings ...)
  2025-05-29 12:58 ` [PATCH v2 06/35] mmc: sdhci-spear: " Binbin Zhou
@ 2025-05-29 12:58 ` Binbin Zhou
  2025-05-29 12:59 ` [PATCH v2 08/35] mmc: sdhci-bcm-kona: " Binbin Zhou
                   ` (27 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 12:58 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

To avoid causing drivers that still use sdhci_pltfm_free() to fail to
compile, it has been temporarily set to empty. And it will be removed
when there are no longer any callers.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-pltfm.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index 62753d72198a..aedbcd32713a 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -148,9 +148,6 @@ EXPORT_SYMBOL_GPL(sdhci_pltfm_init);
 
 void sdhci_pltfm_free(struct platform_device *pdev)
 {
-	struct sdhci_host *host = platform_get_drvdata(pdev);
-
-	sdhci_free_host(host);
 }
 EXPORT_SYMBOL_GPL(sdhci_pltfm_free);
 
@@ -159,7 +156,6 @@ int sdhci_pltfm_init_and_add_host(struct platform_device *pdev,
 				  size_t priv_size)
 {
 	struct sdhci_host *host;
-	int ret = 0;
 
 	host = sdhci_pltfm_init(pdev, pdata, priv_size);
 	if (IS_ERR(host))
@@ -167,11 +163,7 @@ int sdhci_pltfm_init_and_add_host(struct platform_device *pdev,
 
 	sdhci_get_property(pdev);
 
-	ret = sdhci_add_host(host);
-	if (ret)
-		sdhci_pltfm_free(pdev);
-
-	return ret;
+	return sdhci_add_host(host);
 }
 EXPORT_SYMBOL_GPL(sdhci_pltfm_init_and_add_host);
 
@@ -181,7 +173,6 @@ void sdhci_pltfm_remove(struct platform_device *pdev)
 	int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff);
 
 	sdhci_remove_host(host, dead);
-	sdhci_pltfm_free(pdev);
 }
 EXPORT_SYMBOL_GPL(sdhci_pltfm_remove);
 
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 08/35] mmc: sdhci-bcm-kona: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (6 preceding siblings ...)
  2025-05-29 12:58 ` [PATCH v2 07/35] mmc: sdhci-pltfm: Drop the use of sdhci_pltfm_free() Binbin Zhou
@ 2025-05-29 12:59 ` Binbin Zhou
  2025-05-29 12:59 ` [PATCH v2 09/35] mmc: sdhci-brcmstb: " Binbin Zhou
                   ` (26 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 12:59 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou,
	Florian Fainelli, Ray Jui, Scott Branden

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Cc: Florian Fainelli <florian.fainelli@broadcom.com>
Cc: Ray Jui <rjui@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-bcm-kona.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci-bcm-kona.c b/drivers/mmc/host/sdhci-bcm-kona.c
index fda911fb28e5..0f2a84f769b6 100644
--- a/drivers/mmc/host/sdhci-bcm-kona.c
+++ b/drivers/mmc/host/sdhci-bcm-kona.c
@@ -304,8 +304,6 @@ static int sdhci_bcm_kona_probe(struct platform_device *pdev)
 	clk_disable_unprepare(pltfm_priv->clk);
 
 err_pltfm_free:
-	sdhci_pltfm_free(pdev);
-
 	dev_err(dev, "Probing of sdhci-pltfm failed: %d\n", ret);
 	return ret;
 }
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 09/35] mmc: sdhci-brcmstb: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (7 preceding siblings ...)
  2025-05-29 12:59 ` [PATCH v2 08/35] mmc: sdhci-bcm-kona: " Binbin Zhou
@ 2025-05-29 12:59 ` Binbin Zhou
  2025-05-29 12:59 ` [PATCH v2 10/35] mmc: sdhci-cadence: " Binbin Zhou
                   ` (25 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 12:59 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou, Kamal Dasu,
	Al Cooper, Florian Fainelli

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Cc: Kamal Dasu <kamal.dasu@broadcom.com>
Cc: Al Cooper <alcooperx@gmail.com>
Cc: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-brcmstb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
index 48cdcba0f39c..efc2f3bdc631 100644
--- a/drivers/mmc/host/sdhci-brcmstb.c
+++ b/drivers/mmc/host/sdhci-brcmstb.c
@@ -485,7 +485,6 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev)
 	return res;
 
 err:
-	sdhci_pltfm_free(pdev);
 	clk_disable_unprepare(base_clk);
 	return res;
 }
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 10/35] mmc: sdhci-cadence: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (8 preceding siblings ...)
  2025-05-29 12:59 ` [PATCH v2 09/35] mmc: sdhci-brcmstb: " Binbin Zhou
@ 2025-05-29 12:59 ` Binbin Zhou
  2025-05-29 12:59 ` [PATCH v2 11/35] mmc: sdhci-dove: " Binbin Zhou
                   ` (24 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 12:59 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-cadence.c | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
index a94b297fcf2a..a37e6a1f5127 100644
--- a/drivers/mmc/host/sdhci-cadence.c
+++ b/drivers/mmc/host/sdhci-cadence.c
@@ -515,7 +515,7 @@ static int sdhci_cdns_probe(struct platform_device *pdev)
 	if (data->init) {
 		ret = data->init(pdev);
 		if (ret)
-			goto free;
+			return ret;
 	}
 	sdhci_enable_v4_mode(host);
 	__sdhci_read_caps(host, &version, NULL, NULL);
@@ -524,33 +524,24 @@ static int sdhci_cdns_probe(struct platform_device *pdev)
 
 	ret = mmc_of_parse(host->mmc);
 	if (ret)
-		goto free;
+		return ret;
 
 	sdhci_cdns_phy_param_parse(dev->of_node, priv);
 
 	ret = sdhci_cdns_phy_init(priv);
 	if (ret)
-		goto free;
+		return ret;
 
 	if (host->mmc->caps & MMC_CAP_HW_RESET) {
 		priv->rst_hw = devm_reset_control_get_optional_exclusive(dev, NULL);
-		if (IS_ERR(priv->rst_hw)) {
-			ret = dev_err_probe(mmc_dev(host->mmc), PTR_ERR(priv->rst_hw),
+		if (IS_ERR(priv->rst_hw))
+			return dev_err_probe(mmc_dev(host->mmc), PTR_ERR(priv->rst_hw),
 					    "reset controller error\n");
-			goto free;
-		}
 		if (priv->rst_hw)
 			host->mmc_host_ops.card_hw_reset = sdhci_cdns_mmc_hw_reset;
 	}
 
-	ret = sdhci_add_host(host);
-	if (ret)
-		goto free;
-
-	return 0;
-free:
-	sdhci_pltfm_free(pdev);
-	return ret;
+	return sdhci_add_host(host);
 }
 
 #ifdef CONFIG_PM_SLEEP
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 11/35] mmc: sdhci-dove: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (9 preceding siblings ...)
  2025-05-29 12:59 ` [PATCH v2 10/35] mmc: sdhci-cadence: " Binbin Zhou
@ 2025-05-29 12:59 ` Binbin Zhou
  2025-05-29 12:59 ` [PATCH v2 12/35] mmc: sdhci-esdhc-imx: " Binbin Zhou
                   ` (23 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 12:59 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-dove.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/sdhci-dove.c b/drivers/mmc/host/sdhci-dove.c
index 77034b13fa66..dbfaee4a5ada 100644
--- a/drivers/mmc/host/sdhci-dove.c
+++ b/drivers/mmc/host/sdhci-dove.c
@@ -79,17 +79,9 @@ static int sdhci_dove_probe(struct platform_device *pdev)
 
 	ret = mmc_of_parse(host->mmc);
 	if (ret)
-		goto err_sdhci_add;
+		return ret;
 
-	ret = sdhci_add_host(host);
-	if (ret)
-		goto err_sdhci_add;
-
-	return 0;
-
-err_sdhci_add:
-	sdhci_pltfm_free(pdev);
-	return ret;
+	return sdhci_add_host(host);
 }
 
 static const struct of_device_id sdhci_dove_of_match_table[] = {
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 12/35] mmc: sdhci-esdhc-imx: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (10 preceding siblings ...)
  2025-05-29 12:59 ` [PATCH v2 11/35] mmc: sdhci-dove: " Binbin Zhou
@ 2025-05-29 12:59 ` Binbin Zhou
  2025-05-30  2:31   ` Bough Chen
  2025-05-29 12:59 ` [PATCH v2 13/35] mmc: sdhci-esdhc-mcf: " Binbin Zhou
                   ` (22 subsequent siblings)
  34 siblings, 1 reply; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 12:59 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou, Haibo Chen,
	Shawn Guo, Sascha Hauer, Fabio Estevam, imx

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Cc: Haibo Chen <haibo.chen@nxp.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: imx@lists.linux.dev
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-esdhc-imx.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index ac187a8798b7..011b60d21a80 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1973,7 +1973,6 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
 free_sdhci:
 	if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS)
 		cpu_latency_qos_remove_request(&imx_data->pm_qos_req);
-	sdhci_pltfm_free(pdev);
 	return err;
 }
 
@@ -1997,8 +1996,6 @@ static void sdhci_esdhc_imx_remove(struct platform_device *pdev)
 
 	if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS)
 		cpu_latency_qos_remove_request(&imx_data->pm_qos_req);
-
-	sdhci_pltfm_free(pdev);
 }
 
 #ifdef CONFIG_PM_SLEEP
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 13/35] mmc: sdhci-esdhc-mcf: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (11 preceding siblings ...)
  2025-05-29 12:59 ` [PATCH v2 12/35] mmc: sdhci-esdhc-imx: " Binbin Zhou
@ 2025-05-29 12:59 ` Binbin Zhou
  2025-05-29 12:59 ` [PATCH v2 14/35] mmc: sdhci-iproc: " Binbin Zhou
                   ` (21 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 12:59 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou,
	Angelo Dureghello

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Acked-by: Angelo Dureghello <adureghello@baylibre.com>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-esdhc-mcf.c | 25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-mcf.c b/drivers/mmc/host/sdhci-esdhc-mcf.c
index 327662ba5bd9..375fce5639d7 100644
--- a/drivers/mmc/host/sdhci-esdhc-mcf.c
+++ b/drivers/mmc/host/sdhci-esdhc-mcf.c
@@ -426,28 +426,22 @@ static int sdhci_esdhc_mcf_probe(struct platform_device *pdev)
 	host->flags |= SDHCI_AUTO_CMD12;
 
 	mcf_data->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
-	if (IS_ERR(mcf_data->clk_ipg)) {
-		err = PTR_ERR(mcf_data->clk_ipg);
-		goto err_exit;
-	}
+	if (IS_ERR(mcf_data->clk_ipg))
+		return PTR_ERR(mcf_data->clk_ipg);
 
 	mcf_data->clk_ahb = devm_clk_get(&pdev->dev, "ahb");
-	if (IS_ERR(mcf_data->clk_ahb)) {
-		err = PTR_ERR(mcf_data->clk_ahb);
-		goto err_exit;
-	}
+	if (IS_ERR(mcf_data->clk_ahb))
+		return PTR_ERR(mcf_data->clk_ahb);
 
 	mcf_data->clk_per = devm_clk_get(&pdev->dev, "per");
-	if (IS_ERR(mcf_data->clk_per)) {
-		err = PTR_ERR(mcf_data->clk_per);
-		goto err_exit;
-	}
+	if (IS_ERR(mcf_data->clk_per))
+		return PTR_ERR(mcf_data->clk_per);
 
 	pltfm_host->clk = mcf_data->clk_per;
 	pltfm_host->clock = clk_get_rate(pltfm_host->clk);
 	err = clk_prepare_enable(mcf_data->clk_per);
 	if (err)
-		goto err_exit;
+		return err;
 
 	err = clk_prepare_enable(mcf_data->clk_ipg);
 	if (err)
@@ -485,9 +479,6 @@ static int sdhci_esdhc_mcf_probe(struct platform_device *pdev)
 	clk_disable_unprepare(mcf_data->clk_ipg);
 unprep_per:
 	clk_disable_unprepare(mcf_data->clk_per);
-err_exit:
-	sdhci_pltfm_free(pdev);
-
 	return err;
 }
 
@@ -502,8 +493,6 @@ static void sdhci_esdhc_mcf_remove(struct platform_device *pdev)
 	clk_disable_unprepare(mcf_data->clk_ipg);
 	clk_disable_unprepare(mcf_data->clk_ahb);
 	clk_disable_unprepare(mcf_data->clk_per);
-
-	sdhci_pltfm_free(pdev);
 }
 
 static struct platform_driver sdhci_esdhc_mcf_driver = {
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 14/35] mmc: sdhci-iproc: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (12 preceding siblings ...)
  2025-05-29 12:59 ` [PATCH v2 13/35] mmc: sdhci-esdhc-mcf: " Binbin Zhou
@ 2025-05-29 12:59 ` Binbin Zhou
  2025-05-29 12:59 ` [PATCH v2 15/35] mmc: sdhci-msm: " Binbin Zhou
                   ` (20 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 12:59 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou, Ray Jui,
	Scott Branden

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Cc: Ray Jui <rjui@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-iproc.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
index 80b2567a488b..35ef5c5f5146 100644
--- a/drivers/mmc/host/sdhci-iproc.c
+++ b/drivers/mmc/host/sdhci-iproc.c
@@ -379,7 +379,7 @@ static int sdhci_iproc_probe(struct platform_device *pdev)
 
 	ret = mmc_of_parse(host->mmc);
 	if (ret)
-		goto err;
+		return ret;
 
 	sdhci_get_property(pdev);
 
@@ -387,10 +387,8 @@ static int sdhci_iproc_probe(struct platform_device *pdev)
 
 	if (dev->of_node) {
 		pltfm_host->clk = devm_clk_get_enabled(dev, NULL);
-		if (IS_ERR(pltfm_host->clk)) {
-			ret = PTR_ERR(pltfm_host->clk);
-			goto err;
-		}
+		if (IS_ERR(pltfm_host->clk))
+			return PTR_ERR(pltfm_host->clk);
 	}
 
 	if (iproc_host->data->missing_caps) {
@@ -399,15 +397,7 @@ static int sdhci_iproc_probe(struct platform_device *pdev)
 				  &iproc_host->data->caps1);
 	}
 
-	ret = sdhci_add_host(host);
-	if (ret)
-		goto err;
-
-	return 0;
-
-err:
-	sdhci_pltfm_free(pdev);
-	return ret;
+	return sdhci_add_host(host);
 }
 
 static void sdhci_iproc_shutdown(struct platform_device *pdev)
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 15/35] mmc: sdhci-msm: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (13 preceding siblings ...)
  2025-05-29 12:59 ` [PATCH v2 14/35] mmc: sdhci-iproc: " Binbin Zhou
@ 2025-05-29 12:59 ` Binbin Zhou
  2025-05-29 12:59 ` [PATCH v2 16/35] mmc: sdhci-npcm: " Binbin Zhou
                   ` (19 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 12:59 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-msm.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index 57bd49eea777..d60454f28b86 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -2530,7 +2530,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 
 	ret = mmc_of_parse(host->mmc);
 	if (ret)
-		goto pltfm_free;
+		return ret;
 
 	/*
 	 * Based on the compatible string, load the required msm host info from
@@ -2552,7 +2552,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 
 	ret = sdhci_msm_gcc_reset(&pdev->dev, host);
 	if (ret)
-		goto pltfm_free;
+		return ret;
 
 	/* Setup SDCC bus voter clock. */
 	msm_host->bus_clk = devm_clk_get(&pdev->dev, "bus");
@@ -2560,10 +2560,10 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 		/* Vote for max. clk rate for max. performance */
 		ret = clk_set_rate(msm_host->bus_clk, INT_MAX);
 		if (ret)
-			goto pltfm_free;
+			return ret;
 		ret = clk_prepare_enable(msm_host->bus_clk);
 		if (ret)
-			goto pltfm_free;
+			return ret;
 	}
 
 	/* Setup main peripheral bus clock */
@@ -2769,8 +2769,6 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 bus_clk_disable:
 	if (!IS_ERR(msm_host->bus_clk))
 		clk_disable_unprepare(msm_host->bus_clk);
-pltfm_free:
-	sdhci_pltfm_free(pdev);
 	return ret;
 }
 
@@ -2792,7 +2790,6 @@ static void sdhci_msm_remove(struct platform_device *pdev)
 				   msm_host->bulk_clks);
 	if (!IS_ERR(msm_host->bus_clk))
 		clk_disable_unprepare(msm_host->bus_clk);
-	sdhci_pltfm_free(pdev);
 }
 
 static __maybe_unused int sdhci_msm_runtime_suspend(struct device *dev)
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 16/35] mmc: sdhci-npcm: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (14 preceding siblings ...)
  2025-05-29 12:59 ` [PATCH v2 15/35] mmc: sdhci-msm: " Binbin Zhou
@ 2025-05-29 12:59 ` Binbin Zhou
  2025-05-29 12:59 ` [PATCH v2 17/35] mmc: sdhci-of-arasan: " Binbin Zhou
                   ` (18 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 12:59 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou, Avi Fishman,
	Tomer Maimon, Tali Perry, Patrick Venture, Nancy Yuen,
	Benjamin Fair, openbmc

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Cc: Avi Fishman <avifishman70@gmail.com>
Cc: Tomer Maimon <tmaimon77@gmail.com>
Cc: Tali Perry <tali.perry1@gmail.com>
Cc: Patrick Venture <venture@google.com>
Cc: Nancy Yuen <yuenn@google.com>
Cc: Benjamin Fair <benjaminfair@google.com>
Cc: openbmc@lists.ozlabs.org
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-npcm.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/sdhci-npcm.c b/drivers/mmc/host/sdhci-npcm.c
index bee0585ba5c1..71b635dfdf1d 100644
--- a/drivers/mmc/host/sdhci-npcm.c
+++ b/drivers/mmc/host/sdhci-npcm.c
@@ -48,8 +48,7 @@ static int npcm_sdhci_probe(struct platform_device *pdev)
 
 	pltfm_host->clk = devm_clk_get_optional_enabled(dev, NULL);
 	if (IS_ERR(pltfm_host->clk)) {
-		ret = PTR_ERR(pltfm_host->clk);
-		goto err_sdhci;
+		return PTR_ERR(pltfm_host->clk);
 	}
 
 	caps = sdhci_readl(host, SDHCI_CAPABILITIES);
@@ -58,17 +57,9 @@ static int npcm_sdhci_probe(struct platform_device *pdev)
 
 	ret = mmc_of_parse(host->mmc);
 	if (ret)
-		goto err_sdhci;
+		return ret;
 
-	ret = sdhci_add_host(host);
-	if (ret)
-		goto err_sdhci;
-
-	return 0;
-
-err_sdhci:
-	sdhci_pltfm_free(pdev);
-	return ret;
+	return sdhci_add_host(host);
 }
 
 static const struct of_device_id npcm_sdhci_of_match[] = {
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 17/35] mmc: sdhci-of-arasan: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (15 preceding siblings ...)
  2025-05-29 12:59 ` [PATCH v2 16/35] mmc: sdhci-npcm: " Binbin Zhou
@ 2025-05-29 12:59 ` Binbin Zhou
  2025-05-29 13:00 ` [PATCH v2 18/35] mmc: sdhci-of-aspeed: " Binbin Zhou
                   ` (17 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 12:59 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou, Michal Simek

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Cc: Michal Simek <michal.simek@amd.com>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-of-arasan.c | 26 ++++++++------------------
 1 file changed, 8 insertions(+), 18 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index 8c29676ab662..42878474e56e 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -1883,34 +1883,26 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 		sdhci_arasan->soc_ctl_base = syscon_node_to_regmap(node);
 		of_node_put(node);
 
-		if (IS_ERR(sdhci_arasan->soc_ctl_base)) {
-			ret = dev_err_probe(dev,
+		if (IS_ERR(sdhci_arasan->soc_ctl_base))
+			return dev_err_probe(dev,
 					    PTR_ERR(sdhci_arasan->soc_ctl_base),
 					    "Can't get syscon\n");
-			goto err_pltfm_free;
-		}
 	}
 
 	sdhci_get_of_property(pdev);
 
 	sdhci_arasan->clk_ahb = devm_clk_get(dev, "clk_ahb");
-	if (IS_ERR(sdhci_arasan->clk_ahb)) {
-		ret = dev_err_probe(dev, PTR_ERR(sdhci_arasan->clk_ahb),
+	if (IS_ERR(sdhci_arasan->clk_ahb))
+		return dev_err_probe(dev, PTR_ERR(sdhci_arasan->clk_ahb),
 				    "clk_ahb clock not found.\n");
-		goto err_pltfm_free;
-	}
 
 	clk_xin = devm_clk_get(dev, "clk_xin");
-	if (IS_ERR(clk_xin)) {
-		ret = dev_err_probe(dev, PTR_ERR(clk_xin), "clk_xin clock not found.\n");
-		goto err_pltfm_free;
-	}
+	if (IS_ERR(clk_xin))
+		return dev_err_probe(dev, PTR_ERR(clk_xin), "clk_xin clock not found.\n");
 
 	ret = clk_prepare_enable(sdhci_arasan->clk_ahb);
-	if (ret) {
-		dev_err(dev, "Unable to enable AHB clock.\n");
-		goto err_pltfm_free;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "Unable to enable AHB clock.\n");
 
 	/* If clock-frequency property is set, use the provided value */
 	if (pltfm_host->clock &&
@@ -2029,8 +2021,6 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 	clk_disable_unprepare(clk_xin);
 clk_dis_ahb:
 	clk_disable_unprepare(sdhci_arasan->clk_ahb);
-err_pltfm_free:
-	sdhci_pltfm_free(pdev);
 	return ret;
 }
 
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 18/35] mmc: sdhci-of-aspeed: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (16 preceding siblings ...)
  2025-05-29 12:59 ` [PATCH v2 17/35] mmc: sdhci-of-arasan: " Binbin Zhou
@ 2025-05-29 13:00 ` Binbin Zhou
  2025-05-29 13:00 ` [PATCH v2 19/35] mmc: sdhci-of-at91: " Binbin Zhou
                   ` (16 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 13:00 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou, Joel Stanley,
	linux-aspeed, openbmc

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Cc: Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: Joel Stanley <joel@jms.id.au>
Cc: linux-aspeed@lists.ozlabs.org
Cc: openbmc@lists.ozlabs.org
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-of-aspeed.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
index d6de010551b9..ca97b01996b1 100644
--- a/drivers/mmc/host/sdhci-of-aspeed.c
+++ b/drivers/mmc/host/sdhci-of-aspeed.c
@@ -425,10 +425,8 @@ static int aspeed_sdhci_probe(struct platform_device *pdev)
 		return PTR_ERR(pltfm_host->clk);
 
 	ret = clk_prepare_enable(pltfm_host->clk);
-	if (ret) {
-		dev_err(&pdev->dev, "Unable to enable SDIO clock\n");
-		goto err_pltfm_free;
-	}
+	if (ret)
+		return dev_err_probe(&pdev->dev, ret, "Unable to enable SDIO clock\n");
 
 	ret = mmc_of_parse(host->mmc);
 	if (ret)
@@ -445,8 +443,6 @@ static int aspeed_sdhci_probe(struct platform_device *pdev)
 
 err_sdhci_add:
 	clk_disable_unprepare(pltfm_host->clk);
-err_pltfm_free:
-	sdhci_pltfm_free(pdev);
 	return ret;
 }
 
@@ -461,8 +457,6 @@ static void aspeed_sdhci_remove(struct platform_device *pdev)
 	sdhci_remove_host(host, 0);
 
 	clk_disable_unprepare(pltfm_host->clk);
-
-	sdhci_pltfm_free(pdev);
 }
 
 static const struct aspeed_sdhci_pdata ast2400_sdhci_pdata = {
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 19/35] mmc: sdhci-of-at91: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (17 preceding siblings ...)
  2025-05-29 13:00 ` [PATCH v2 18/35] mmc: sdhci-of-aspeed: " Binbin Zhou
@ 2025-05-29 13:00 ` Binbin Zhou
  2025-06-02 16:09   ` Aubin Constans
  2025-05-29 13:00 ` [PATCH v2 20/35] mmc: sdhci-of-dwcmshc: " Binbin Zhou
                   ` (15 subsequent siblings)
  34 siblings, 1 reply; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 13:00 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou,
	Aubin Constans, Eugen Hristev, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Cc: Aubin Constans <aubin.constans@microchip.com>
Cc: Eugen Hristev <eugen.hristev@linaro.org>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-of-at91.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
index 97988ed37467..0b7d7db79139 100644
--- a/drivers/mmc/host/sdhci-of-at91.c
+++ b/drivers/mmc/host/sdhci-of-at91.c
@@ -337,28 +337,23 @@ static int sdhci_at91_probe(struct platform_device *pdev)
 			priv->mainck = NULL;
 		} else {
 			dev_err(&pdev->dev, "failed to get baseclk\n");
-			ret = PTR_ERR(priv->mainck);
-			goto sdhci_pltfm_free;
+			return PTR_ERR(priv->mainck);
 		}
 	}
 
 	priv->hclock = devm_clk_get(&pdev->dev, "hclock");
-	if (IS_ERR(priv->hclock)) {
-		dev_err(&pdev->dev, "failed to get hclock\n");
-		ret = PTR_ERR(priv->hclock);
-		goto sdhci_pltfm_free;
-	}
+	if (IS_ERR(priv->hclock))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->hclock),
+				     "failed to get hclock\n");
 
 	priv->gck = devm_clk_get(&pdev->dev, "multclk");
-	if (IS_ERR(priv->gck)) {
-		dev_err(&pdev->dev, "failed to get multclk\n");
-		ret = PTR_ERR(priv->gck);
-		goto sdhci_pltfm_free;
-	}
+	if (IS_ERR(priv->gck))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->gck),
+				     "failed to get multclk\n");
 
 	ret = sdhci_at91_set_clks_presets(&pdev->dev);
 	if (ret)
-		goto sdhci_pltfm_free;
+		return ret;
 
 	priv->restore_needed = false;
 
@@ -438,8 +433,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
 	clk_disable_unprepare(priv->gck);
 	clk_disable_unprepare(priv->mainck);
 	clk_disable_unprepare(priv->hclock);
-sdhci_pltfm_free:
-	sdhci_pltfm_free(pdev);
 	return ret;
 }
 
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 20/35] mmc: sdhci-of-dwcmshc: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (18 preceding siblings ...)
  2025-05-29 13:00 ` [PATCH v2 19/35] mmc: sdhci-of-at91: " Binbin Zhou
@ 2025-05-29 13:00 ` Binbin Zhou
  2025-05-29 13:00 ` [PATCH v2 21/35] mmc: sdhci-of-esdhc: " Binbin Zhou
                   ` (14 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 13:00 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-of-dwcmshc.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
index a20d03fdd6a9..ee6b1096f709 100644
--- a/drivers/mmc/host/sdhci-of-dwcmshc.c
+++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
@@ -1387,14 +1387,13 @@ static int dwcmshc_probe(struct platform_device *pdev)
 
 	if (dev->of_node) {
 		pltfm_host->clk = devm_clk_get(dev, "core");
-		if (IS_ERR(pltfm_host->clk)) {
-			err = PTR_ERR(pltfm_host->clk);
-			dev_err(dev, "failed to get core clk: %d\n", err);
-			goto free_pltfm;
-		}
+		if (IS_ERR(pltfm_host->clk))
+			return dev_err_probe(dev, PTR_ERR(pltfm_host->clk),
+					     "failed to get core clk\n");
+
 		err = clk_prepare_enable(pltfm_host->clk);
 		if (err)
-			goto free_pltfm;
+			return err;
 
 		priv->bus_clk = devm_clk_get(dev, "bus");
 		if (!IS_ERR(priv->bus_clk))
@@ -1467,8 +1466,6 @@ static int dwcmshc_probe(struct platform_device *pdev)
 	clk_disable_unprepare(pltfm_host->clk);
 	clk_disable_unprepare(priv->bus_clk);
 	clk_bulk_disable_unprepare(priv->num_other_clks, priv->other_clks);
-free_pltfm:
-	sdhci_pltfm_free(pdev);
 	return err;
 }
 
@@ -1500,7 +1497,6 @@ static void dwcmshc_remove(struct platform_device *pdev)
 	clk_disable_unprepare(pltfm_host->clk);
 	clk_disable_unprepare(priv->bus_clk);
 	clk_bulk_disable_unprepare(priv->num_other_clks, priv->other_clks);
-	sdhci_pltfm_free(pdev);
 }
 
 #ifdef CONFIG_PM_SLEEP
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 21/35] mmc: sdhci-of-esdhc: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (19 preceding siblings ...)
  2025-05-29 13:00 ` [PATCH v2 20/35] mmc: sdhci-of-dwcmshc: " Binbin Zhou
@ 2025-05-29 13:00 ` Binbin Zhou
  2025-05-29 13:00 ` [PATCH v2 22/35] mmc: sdhci-of-k1: " Binbin Zhou
                   ` (13 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 13:00 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-of-esdhc.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index 002d0d59b992..c6ee0099ead0 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -1499,18 +1499,11 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)
 	/* call to generic mmc_of_parse to support additional capabilities */
 	ret = mmc_of_parse(host->mmc);
 	if (ret)
-		goto err;
+		return ret;
 
 	mmc_of_parse_voltage(host->mmc, &host->ocr_mask);
 
-	ret = sdhci_add_host(host);
-	if (ret)
-		goto err;
-
-	return 0;
- err:
-	sdhci_pltfm_free(pdev);
-	return ret;
+	return sdhci_add_host(host);
 }
 
 static struct platform_driver sdhci_esdhc_driver = {
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 22/35] mmc: sdhci-of-k1: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (20 preceding siblings ...)
  2025-05-29 13:00 ` [PATCH v2 21/35] mmc: sdhci-of-esdhc: " Binbin Zhou
@ 2025-05-29 13:00 ` Binbin Zhou
  2025-05-29 15:23   ` Yixun Lan
  2025-05-29 13:11 ` [PATCH v2 23/35] mmc: sdhci-of-ma35d1: " Binbin Zhou
                   ` (12 subsequent siblings)
  34 siblings, 1 reply; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 13:00 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou, Yixun Lan,
	linux-riscv, spacemit

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Cc: Yixun Lan <dlan@gentoo.org>
Cc: linux-riscv@lists.infradead.org
Cc: spacemit@lists.linux.dev
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-of-k1.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-of-k1.c b/drivers/mmc/host/sdhci-of-k1.c
index 6880d3e9ab62..026dc79af292 100644
--- a/drivers/mmc/host/sdhci-of-k1.c
+++ b/drivers/mmc/host/sdhci-of-k1.c
@@ -286,7 +286,6 @@ static int spacemit_sdhci_probe(struct platform_device *pdev)
 	return 0;
 
 err_pltfm:
-	sdhci_pltfm_free(pdev);
 	return ret;
 }
 
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 23/35] mmc: sdhci-of-ma35d1: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (21 preceding siblings ...)
  2025-05-29 13:00 ` [PATCH v2 22/35] mmc: sdhci-of-k1: " Binbin Zhou
@ 2025-05-29 13:11 ` Binbin Zhou
  2025-05-29 13:14 ` [PATCH v2 24/35] mmc: sdhci-of-sparx5: " Binbin Zhou
                   ` (11 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 13:11 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou, Jacky Huang,
	Shan-Chun Hung

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Cc: Jacky Huang <ychuang3@nuvoton.com>
Cc: Shan-Chun Hung <schung@nuvoton.com>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-of-ma35d1.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-ma35d1.c b/drivers/mmc/host/sdhci-of-ma35d1.c
index 1e6d180100ad..287026422616 100644
--- a/drivers/mmc/host/sdhci-of-ma35d1.c
+++ b/drivers/mmc/host/sdhci-of-ma35d1.c
@@ -211,20 +211,18 @@ static int ma35_probe(struct platform_device *pdev)
 	priv = sdhci_pltfm_priv(pltfm_host);
 
 	pltfm_host->clk = devm_clk_get_optional_enabled(dev, NULL);
-	if (IS_ERR(pltfm_host->clk)) {
-		err = dev_err_probe(dev, PTR_ERR(pltfm_host->clk), "failed to get clk\n");
-		goto err_sdhci;
-	}
+	if (IS_ERR(pltfm_host->clk))
+		return dev_err_probe(dev, PTR_ERR(pltfm_host->clk),
+				     "failed to get clk\n");
 
 	err = mmc_of_parse(host->mmc);
 	if (err)
-		goto err_sdhci;
+		return err;
 
 	priv->rst = devm_reset_control_get_exclusive(dev, NULL);
-	if (IS_ERR(priv->rst)) {
-		err = dev_err_probe(dev, PTR_ERR(priv->rst), "failed to get reset control\n");
-		goto err_sdhci;
-	}
+	if (IS_ERR(priv->rst))
+		return dev_err_probe(dev, PTR_ERR(priv->rst),
+				     "failed to get reset control\n");
 
 	sdhci_get_of_property(pdev);
 
@@ -255,7 +253,7 @@ static int ma35_probe(struct platform_device *pdev)
 
 	err = sdhci_add_host(host);
 	if (err)
-		goto err_sdhci;
+		return err;
 
 	/*
 	 * Split data into chunks of 16 or 8 bytes for transmission.
@@ -268,10 +266,6 @@ static int ma35_probe(struct platform_device *pdev)
 	sdhci_writew(host, ctl, MA35_SDHCI_MBIUCTL);
 
 	return 0;
-
-err_sdhci:
-	sdhci_pltfm_free(pdev);
-	return err;
 }
 
 static void ma35_disable_card_clk(struct sdhci_host *host)
@@ -291,7 +285,6 @@ static void ma35_remove(struct platform_device *pdev)
 
 	sdhci_remove_host(host, 0);
 	ma35_disable_card_clk(host);
-	sdhci_pltfm_free(pdev);
 }
 
 static const struct of_device_id sdhci_ma35_dt_ids[] = {
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 24/35] mmc: sdhci-of-sparx5: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (22 preceding siblings ...)
  2025-05-29 13:11 ` [PATCH v2 23/35] mmc: sdhci-of-ma35d1: " Binbin Zhou
@ 2025-05-29 13:14 ` Binbin Zhou
  2025-05-29 13:16 ` [PATCH v2 25/35] mmc: sdhci-omap: " Binbin Zhou
                   ` (10 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 13:14 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou,
	Steen Hegelund, Daniel Machon

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Cc: Steen Hegelund <Steen.Hegelund@microchip.com>
Cc: Daniel Machon <daniel.machon@microchip.com>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-of-sparx5.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-sparx5.c b/drivers/mmc/host/sdhci-of-sparx5.c
index d2aa684e786f..b3db1e2c4c0e 100644
--- a/drivers/mmc/host/sdhci-of-sparx5.c
+++ b/drivers/mmc/host/sdhci-of-sparx5.c
@@ -185,11 +185,9 @@ static int sdhci_sparx5_probe(struct platform_device *pdev)
 	sdhci_sparx5->host = host;
 
 	pltfm_host->clk = devm_clk_get_enabled(&pdev->dev, "core");
-	if (IS_ERR(pltfm_host->clk)) {
-		ret = PTR_ERR(pltfm_host->clk);
-		dev_err(&pdev->dev, "failed to get and enable core clk: %d\n", ret);
-		goto free_pltfm;
-	}
+	if (IS_ERR(pltfm_host->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(pltfm_host->clk),
+				     "failed to get and enable core clk\n");
 
 	if (!of_property_read_u32(np, "microchip,clock-delay", &value) &&
 	    (value > 0 && value <= MSHC_DLY_CC_MAX))
@@ -199,14 +197,12 @@ static int sdhci_sparx5_probe(struct platform_device *pdev)
 
 	ret = mmc_of_parse(host->mmc);
 	if (ret)
-		goto free_pltfm;
+		return ret;
 
 	sdhci_sparx5->cpu_ctrl = syscon_regmap_lookup_by_compatible(syscon);
-	if (IS_ERR(sdhci_sparx5->cpu_ctrl)) {
-		dev_err(&pdev->dev, "No CPU syscon regmap !\n");
-		ret = PTR_ERR(sdhci_sparx5->cpu_ctrl);
-		goto free_pltfm;
-	}
+	if (IS_ERR(sdhci_sparx5->cpu_ctrl))
+		return dev_err_probe(&pdev->dev, PTR_ERR(sdhci_sparx5->cpu_ctrl),
+				     "No CPU syscon regmap !\n");
 
 	if (sdhci_sparx5->delay_clock >= 0)
 		sparx5_set_delay(host, sdhci_sparx5->delay_clock);
@@ -222,7 +218,7 @@ static int sdhci_sparx5_probe(struct platform_device *pdev)
 
 	ret = sdhci_add_host(host);
 	if (ret)
-		goto free_pltfm;
+		return ret;
 
 	/* Set AXI bus master to use un-cached access (for DMA) */
 	if (host->flags & (SDHCI_USE_SDMA | SDHCI_USE_ADMA) &&
@@ -235,10 +231,6 @@ static int sdhci_sparx5_probe(struct platform_device *pdev)
 		 mmc_hostname(host->mmc), sdhci_readl(host, MSHC2_TYPE));
 
 	return ret;
-
-free_pltfm:
-	sdhci_pltfm_free(pdev);
-	return ret;
 }
 
 static const struct of_device_id sdhci_sparx5_of_match[] = {
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 25/35] mmc: sdhci-omap: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (23 preceding siblings ...)
  2025-05-29 13:14 ` [PATCH v2 24/35] mmc: sdhci-of-sparx5: " Binbin Zhou
@ 2025-05-29 13:16 ` Binbin Zhou
  2025-05-29 13:17 ` [PATCH v2 26/35] mmc: sdhci-pic32: " Binbin Zhou
                   ` (9 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 13:16 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou,
	Vignesh Raghavendra

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Cc: Vignesh Raghavendra <vigneshr@ti.com>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-omap.c | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
index 8897839ab2aa..429d8a517fb6 100644
--- a/drivers/mmc/host/sdhci-omap.c
+++ b/drivers/mmc/host/sdhci-omap.c
@@ -1257,7 +1257,7 @@ static int sdhci_omap_probe(struct platform_device *pdev)
 	sdhci_get_of_property(pdev);
 	ret = mmc_of_parse(mmc);
 	if (ret)
-		goto err_pltfm_free;
+		return ret;
 
 	soc = soc_device_match(sdhci_omap_soc_devices);
 	if (soc) {
@@ -1274,22 +1274,19 @@ static int sdhci_omap_probe(struct platform_device *pdev)
 		mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT;
 
 	pltfm_host->clk = devm_clk_get(dev, "fck");
-	if (IS_ERR(pltfm_host->clk)) {
-		ret = PTR_ERR(pltfm_host->clk);
-		goto err_pltfm_free;
-	}
+	if (IS_ERR(pltfm_host->clk))
+		return PTR_ERR(pltfm_host->clk);
 
 	ret = clk_set_rate(pltfm_host->clk, mmc->f_max);
-	if (ret) {
-		dev_err(dev, "failed to set clock to %d\n", mmc->f_max);
-		goto err_pltfm_free;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret,
+				     "failed to set clock to %d\n", mmc->f_max);
 
 	omap_host->pbias = devm_regulator_get_optional(dev, "pbias");
 	if (IS_ERR(omap_host->pbias)) {
 		ret = PTR_ERR(omap_host->pbias);
 		if (ret != -ENODEV)
-			goto err_pltfm_free;
+			return ret;
 		dev_dbg(dev, "unable to get pbias regulator %d\n", ret);
 	}
 	omap_host->pbias_enabled = false;
@@ -1387,9 +1384,6 @@ static int sdhci_omap_probe(struct platform_device *pdev)
 err_rpm_disable:
 	pm_runtime_dont_use_autosuspend(dev);
 	pm_runtime_disable(dev);
-
-err_pltfm_free:
-	sdhci_pltfm_free(pdev);
 	return ret;
 }
 
@@ -1406,7 +1400,6 @@ static void sdhci_omap_remove(struct platform_device *pdev)
 	pm_runtime_put_sync(dev);
 	/* Ensure device gets disabled despite userspace sysfs config */
 	pm_runtime_force_suspend(dev);
-	sdhci_pltfm_free(pdev);
 }
 
 #ifdef CONFIG_PM
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 26/35] mmc: sdhci-pic32: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (24 preceding siblings ...)
  2025-05-29 13:16 ` [PATCH v2 25/35] mmc: sdhci-omap: " Binbin Zhou
@ 2025-05-29 13:17 ` Binbin Zhou
  2025-05-29 13:19 ` [PATCH v2 27/35] mmc: sdhci-pxav2: " Binbin Zhou
                   ` (8 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 13:17 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-pic32.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pic32.c b/drivers/mmc/host/sdhci-pic32.c
index d6a299f49900..7ddac0befed8 100644
--- a/drivers/mmc/host/sdhci-pic32.c
+++ b/drivers/mmc/host/sdhci-pic32.c
@@ -157,20 +157,20 @@ static int pic32_sdhci_probe(struct platform_device *pdev)
 		ret = plat_data->setup_dma(ADMA_FIFO_RD_THSHLD,
 					   ADMA_FIFO_WR_THSHLD);
 		if (ret)
-			goto err_host;
+			goto err;
 	}
 
 	sdhci_pdata->sys_clk = devm_clk_get(&pdev->dev, "sys_clk");
 	if (IS_ERR(sdhci_pdata->sys_clk)) {
 		ret = PTR_ERR(sdhci_pdata->sys_clk);
 		dev_err(&pdev->dev, "Error getting clock\n");
-		goto err_host;
+		goto err;
 	}
 
 	ret = clk_prepare_enable(sdhci_pdata->sys_clk);
 	if (ret) {
 		dev_err(&pdev->dev, "Error enabling clock\n");
-		goto err_host;
+		goto err;
 	}
 
 	sdhci_pdata->base_clk = devm_clk_get(&pdev->dev, "base_clk");
@@ -203,8 +203,6 @@ static int pic32_sdhci_probe(struct platform_device *pdev)
 	clk_disable_unprepare(sdhci_pdata->base_clk);
 err_sys_clk:
 	clk_disable_unprepare(sdhci_pdata->sys_clk);
-err_host:
-	sdhci_pltfm_free(pdev);
 err:
 	dev_err(&pdev->dev, "pic32-sdhci probe failed: %d\n", ret);
 	return ret;
@@ -220,7 +218,6 @@ static void pic32_sdhci_remove(struct platform_device *pdev)
 	sdhci_remove_host(host, scratch == (u32)~0);
 	clk_disable_unprepare(sdhci_pdata->base_clk);
 	clk_disable_unprepare(sdhci_pdata->sys_clk);
-	sdhci_pltfm_free(pdev);
 }
 
 static const struct of_device_id pic32_sdhci_id_table[] = {
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 27/35] mmc: sdhci-pxav2: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (25 preceding siblings ...)
  2025-05-29 13:17 ` [PATCH v2 26/35] mmc: sdhci-pic32: " Binbin Zhou
@ 2025-05-29 13:19 ` Binbin Zhou
  2025-05-29 13:20 ` [PATCH v2 28/35] mmc: sdhci-pxav3: " Binbin Zhou
                   ` (7 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 13:19 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-pxav2.c | 26 ++++++--------------------
 1 file changed, 6 insertions(+), 20 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c
index 45b6f0891c47..76346353dc55 100644
--- a/drivers/mmc/host/sdhci-pxav2.c
+++ b/drivers/mmc/host/sdhci-pxav2.c
@@ -258,7 +258,6 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
 	struct sdhci_host *host = NULL;
 	const struct sdhci_pxa_variant *variant;
 
-	int ret;
 	struct clk *clk, *clk_core;
 
 	host = sdhci_pltfm_init(pdev, NULL, sizeof(*pxav2_host));
@@ -271,19 +270,14 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
 	clk = devm_clk_get_optional_enabled(dev, "io");
 	if (!clk)
 		clk = devm_clk_get_enabled(dev, NULL);
-	if (IS_ERR(clk)) {
-		ret = PTR_ERR(clk);
-		dev_err_probe(dev, ret, "failed to get io clock\n");
-		goto free;
-	}
+	if (IS_ERR(clk))
+		return dev_err_probe(dev, PTR_ERR(clk), "failed to get io clock\n");
 	pltfm_host->clk = clk;
 
 	clk_core = devm_clk_get_optional_enabled(dev, "core");
-	if (IS_ERR(clk_core)) {
-		ret = PTR_ERR(clk_core);
-		dev_err_probe(dev, ret, "failed to enable core clock\n");
-		goto free;
-	}
+	if (IS_ERR(clk_core))
+		return dev_err_probe(dev, PTR_ERR(clk_core),
+				     "failed to enable core clock\n");
 
 	host->quirks = SDHCI_QUIRK_BROKEN_ADMA
 		| SDHCI_QUIRK_BROKEN_TIMEOUT_VAL
@@ -332,15 +326,7 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
 		pxav2_host->pinctrl = NULL;
 	}
 
-	ret = sdhci_add_host(host);
-	if (ret)
-		goto free;
-
-	return 0;
-
-free:
-	sdhci_pltfm_free(pdev);
-	return ret;
+	return sdhci_add_host(host);
 }
 
 static struct platform_driver sdhci_pxav2_driver = {
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 28/35] mmc: sdhci-pxav3: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (26 preceding siblings ...)
  2025-05-29 13:19 ` [PATCH v2 27/35] mmc: sdhci-pxav2: " Binbin Zhou
@ 2025-05-29 13:20 ` Binbin Zhou
  2025-05-29 13:21 ` [PATCH v2 29/35] mmc: sdhci-sprd: " Binbin Zhou
                   ` (6 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 13:20 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-pxav3.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index 3fb56face3d8..7173a0296738 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -389,8 +389,7 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
 		pxa->clk_io = devm_clk_get(dev, NULL);
 	if (IS_ERR(pxa->clk_io)) {
 		dev_err(dev, "failed to get io clock\n");
-		ret = PTR_ERR(pxa->clk_io);
-		goto err_clk_get;
+		return PTR_ERR(pxa->clk_io);
 	}
 	pltfm_host->clk = pxa->clk_io;
 	clk_prepare_enable(pxa->clk_io);
@@ -466,8 +465,6 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
 err_mbus_win:
 	clk_disable_unprepare(pxa->clk_io);
 	clk_disable_unprepare(pxa->clk_core);
-err_clk_get:
-	sdhci_pltfm_free(pdev);
 	return ret;
 }
 
@@ -485,8 +482,6 @@ static void sdhci_pxav3_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(pxa->clk_io);
 	clk_disable_unprepare(pxa->clk_core);
-
-	sdhci_pltfm_free(pdev);
 }
 
 #ifdef CONFIG_PM_SLEEP
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 29/35] mmc: sdhci-sprd: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (27 preceding siblings ...)
  2025-05-29 13:20 ` [PATCH v2 28/35] mmc: sdhci-pxav3: " Binbin Zhou
@ 2025-05-29 13:21 ` Binbin Zhou
  2025-05-29 13:22 ` [PATCH v2 30/35] mmc: sdhci-st: " Binbin Zhou
                   ` (5 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 13:21 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou, Orson Zhai,
	Baolin Wang, Chunyan Zhang

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Cc: Orson Zhai <orsonzhai@gmail.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Reviewed-by: Chunyan Zhang <zhang.lyra@gmail.com>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-sprd.c | 33 ++++++++++-----------------------
 1 file changed, 10 insertions(+), 23 deletions(-)

diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c
index db5e253b0f79..a5dec1a0e934 100644
--- a/drivers/mmc/host/sdhci-sprd.c
+++ b/drivers/mmc/host/sdhci-sprd.c
@@ -764,7 +764,7 @@ static int sdhci_sprd_probe(struct platform_device *pdev)
 
 	ret = mmc_of_parse(host->mmc);
 	if (ret)
-		goto pltfm_free;
+		return ret;
 
 	if (!mmc_card_is_removable(host->mmc))
 		host->mmc_host_ops.request_atomic = sdhci_sprd_request_atomic;
@@ -778,34 +778,26 @@ static int sdhci_sprd_probe(struct platform_device *pdev)
 	if (!IS_ERR(sprd_host->pinctrl)) {
 		sprd_host->pins_uhs =
 			pinctrl_lookup_state(sprd_host->pinctrl, "state_uhs");
-		if (IS_ERR(sprd_host->pins_uhs)) {
-			ret = PTR_ERR(sprd_host->pins_uhs);
-			goto pltfm_free;
-		}
+		if (IS_ERR(sprd_host->pins_uhs))
+			return PTR_ERR(sprd_host->pins_uhs);
 
 		sprd_host->pins_default =
 			pinctrl_lookup_state(sprd_host->pinctrl, "default");
-		if (IS_ERR(sprd_host->pins_default)) {
-			ret = PTR_ERR(sprd_host->pins_default);
-			goto pltfm_free;
-		}
+		if (IS_ERR(sprd_host->pins_default))
+			return PTR_ERR(sprd_host->pins_default);
 	}
 
 	clk = devm_clk_get(&pdev->dev, "sdio");
-	if (IS_ERR(clk)) {
-		ret = PTR_ERR(clk);
-		goto pltfm_free;
-	}
+	if (IS_ERR(clk))
+		return PTR_ERR(clk);
 	sprd_host->clk_sdio = clk;
 	sprd_host->base_rate = clk_get_rate(sprd_host->clk_sdio);
 	if (!sprd_host->base_rate)
 		sprd_host->base_rate = SDHCI_SPRD_CLK_DEF_RATE;
 
 	clk = devm_clk_get(&pdev->dev, "enable");
-	if (IS_ERR(clk)) {
-		ret = PTR_ERR(clk);
-		goto pltfm_free;
-	}
+	if (IS_ERR(clk))
+		return PTR_ERR(clk);
 	sprd_host->clk_enable = clk;
 
 	clk = devm_clk_get(&pdev->dev, "2x_enable");
@@ -814,7 +806,7 @@ static int sdhci_sprd_probe(struct platform_device *pdev)
 
 	ret = clk_prepare_enable(sprd_host->clk_sdio);
 	if (ret)
-		goto pltfm_free;
+		return ret;
 
 	ret = clk_prepare_enable(sprd_host->clk_enable);
 	if (ret)
@@ -891,9 +883,6 @@ static int sdhci_sprd_probe(struct platform_device *pdev)
 
 clk_disable:
 	clk_disable_unprepare(sprd_host->clk_sdio);
-
-pltfm_free:
-	sdhci_pltfm_free(pdev);
 	return ret;
 }
 
@@ -907,8 +896,6 @@ static void sdhci_sprd_remove(struct platform_device *pdev)
 	clk_disable_unprepare(sprd_host->clk_sdio);
 	clk_disable_unprepare(sprd_host->clk_enable);
 	clk_disable_unprepare(sprd_host->clk_2x_enable);
-
-	sdhci_pltfm_free(pdev);
 }
 
 static const struct of_device_id sdhci_sprd_of_match[] = {
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 30/35] mmc: sdhci-st: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (28 preceding siblings ...)
  2025-05-29 13:21 ` [PATCH v2 29/35] mmc: sdhci-sprd: " Binbin Zhou
@ 2025-05-29 13:22 ` Binbin Zhou
  2025-05-29 13:23 ` [PATCH v2 31/35] mmc: sdhci-tegra: " Binbin Zhou
                   ` (4 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 13:22 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou,
	Patrice Chotard

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-st.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/sdhci-st.c b/drivers/mmc/host/sdhci-st.c
index 4973e08a98f8..9157342ff7a4 100644
--- a/drivers/mmc/host/sdhci-st.c
+++ b/drivers/mmc/host/sdhci-st.c
@@ -380,13 +380,13 @@ static int sdhci_st_probe(struct platform_device *pdev)
 	ret = mmc_of_parse(host->mmc);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed mmc_of_parse\n");
-		goto err_of;
+		goto err_pltfm_init;
 	}
 
 	ret = clk_prepare_enable(clk);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to prepare clock\n");
-		goto err_of;
+		goto err_pltfm_init;
 	}
 
 	ret = clk_prepare_enable(icnclk);
@@ -423,8 +423,6 @@ static int sdhci_st_probe(struct platform_device *pdev)
 	clk_disable_unprepare(icnclk);
 err_icnclk:
 	clk_disable_unprepare(clk);
-err_of:
-	sdhci_pltfm_free(pdev);
 err_pltfm_init:
 	reset_control_assert(rstc);
 
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 31/35] mmc: sdhci-tegra: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (29 preceding siblings ...)
  2025-05-29 13:22 ` [PATCH v2 30/35] mmc: sdhci-st: " Binbin Zhou
@ 2025-05-29 13:23 ` Binbin Zhou
  2025-05-29 13:24 ` [PATCH v2 32/35] mmc: sdhci-xenon: " Binbin Zhou
                   ` (3 subsequent siblings)
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 13:23 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou,
	Thierry Reding, Jonathan Hunter, linux-tegra

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Jonathan Hunter <jonathanh@nvidia.com>
Cc: linux-tegra@vger.kernel.org
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-tegra.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index b2f5c3f8b839..c811297185d8 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -1693,7 +1693,7 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
 
 	rc = mmc_of_parse(host->mmc);
 	if (rc)
-		goto err_parse_dt;
+		return rc;
 
 	if (tegra_host->soc_data->nvquirks & NVQUIRK_ENABLE_DDR50)
 		host->mmc->caps |= MMC_CAP_1_8V_DDR;
@@ -1739,7 +1739,7 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
 		if (IS_ERR(clk)) {
 			rc = PTR_ERR(clk);
 			if (rc == -EPROBE_DEFER)
-				goto err_power_req;
+				return rc;
 
 			dev_warn(&pdev->dev, "failed to get tmclk: %d\n", rc);
 			clk = NULL;
@@ -1750,7 +1750,7 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
 		if (rc) {
 			dev_err(&pdev->dev,
 				"failed to enable tmclk: %d\n", rc);
-			goto err_power_req;
+			return rc;
 		}
 
 		tegra_host->tmclk = clk;
@@ -1811,8 +1811,6 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
 err_clk_get:
 	clk_disable_unprepare(tegra_host->tmclk);
 err_power_req:
-err_parse_dt:
-	sdhci_pltfm_free(pdev);
 	return rc;
 }
 
@@ -1831,7 +1829,6 @@ static void sdhci_tegra_remove(struct platform_device *pdev)
 	pm_runtime_force_suspend(&pdev->dev);
 
 	clk_disable_unprepare(tegra_host->tmclk);
-	sdhci_pltfm_free(pdev);
 }
 
 static int __maybe_unused sdhci_tegra_runtime_suspend(struct device *dev)
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 32/35] mmc: sdhci-xenon: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (30 preceding siblings ...)
  2025-05-29 13:23 ` [PATCH v2 31/35] mmc: sdhci-tegra: " Binbin Zhou
@ 2025-05-29 13:24 ` Binbin Zhou
  2025-05-30  0:20   ` kernel test robot
  2025-06-02  6:48   ` Dan Carpenter
  2025-05-29 13:25 ` [PATCH v2 33/35] mmc: sdhci_am654: " Binbin Zhou
                   ` (2 subsequent siblings)
  34 siblings, 2 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 13:24 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou, Hu Ziji

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Cc: Hu Ziji <huziji@marvell.com>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-xenon.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/sdhci-xenon.c b/drivers/mmc/host/sdhci-xenon.c
index 098f0ea45cbe..20efb0225d3a 100644
--- a/drivers/mmc/host/sdhci-xenon.c
+++ b/drivers/mmc/host/sdhci-xenon.c
@@ -533,13 +533,12 @@ static int xenon_probe(struct platform_device *pdev)
 	if (dev->of_node) {
 		pltfm_host->clk = devm_clk_get(&pdev->dev, "core");
 		if (IS_ERR(pltfm_host->clk)) {
-			err = PTR_ERR(pltfm_host->clk);
 			dev_err(&pdev->dev, "Failed to setup input clk: %d\n", err);
-			goto free_pltfm;
+			return PTR_ERR(pltfm_host->clk);
 		}
 		err = clk_prepare_enable(pltfm_host->clk);
 		if (err)
-			goto free_pltfm;
+			return err;
 
 		priv->axi_clk = devm_clk_get(&pdev->dev, "axi");
 		if (IS_ERR(priv->axi_clk)) {
@@ -603,8 +602,6 @@ static int xenon_probe(struct platform_device *pdev)
 	clk_disable_unprepare(priv->axi_clk);
 err_clk:
 	clk_disable_unprepare(pltfm_host->clk);
-free_pltfm:
-	sdhci_pltfm_free(pdev);
 	return err;
 }
 
@@ -623,8 +620,6 @@ static void xenon_remove(struct platform_device *pdev)
 	xenon_sdhc_unprepare(host);
 	clk_disable_unprepare(priv->axi_clk);
 	clk_disable_unprepare(pltfm_host->clk);
-
-	sdhci_pltfm_free(pdev);
 }
 
 #ifdef CONFIG_PM_SLEEP
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 33/35] mmc: sdhci_am654: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (31 preceding siblings ...)
  2025-05-29 13:24 ` [PATCH v2 32/35] mmc: sdhci-xenon: " Binbin Zhou
@ 2025-05-29 13:25 ` Binbin Zhou
  2025-05-29 13:26 ` [PATCH v2 34/35] mmc: sdhci_f_sdh30: " Binbin Zhou
  2025-05-29 13:28 ` [PATCH v2 35/35] mmc: sdhci: Drop sdhci_free_host()/sdhci_pltfm_free() definitions Binbin Zhou
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 13:25 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci_am654.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
index 73385ff4c0f3..58258e275dbb 100644
--- a/drivers/mmc/host/sdhci_am654.c
+++ b/drivers/mmc/host/sdhci_am654.c
@@ -942,35 +942,30 @@ static int sdhci_am654_probe(struct platform_device *pdev)
 	clk_xin = devm_clk_get(dev, "clk_xin");
 	if (IS_ERR(clk_xin)) {
 		dev_err(dev, "clk_xin clock not found.\n");
-		ret = PTR_ERR(clk_xin);
-		goto err_pltfm_free;
+		return PTR_ERR(clk_xin);
 	}
 
 	pltfm_host->clk = clk_xin;
 
 	base = devm_platform_ioremap_resource(pdev, 1);
 	if (IS_ERR(base)) {
-		ret = PTR_ERR(base);
-		goto err_pltfm_free;
+		return PTR_ERR(base);
 	}
 
 	sdhci_am654->base = devm_regmap_init_mmio(dev, base,
 						  &sdhci_am654_regmap_config);
 	if (IS_ERR(sdhci_am654->base)) {
 		dev_err(dev, "Failed to initialize regmap\n");
-		ret = PTR_ERR(sdhci_am654->base);
-		goto err_pltfm_free;
+		return PTR_ERR(sdhci_am654->base);
 	}
 
 	ret = sdhci_am654_get_of_property(pdev, sdhci_am654);
 	if (ret)
-		goto err_pltfm_free;
+		return ret;
 
 	ret = mmc_of_parse(host->mmc);
-	if (ret) {
-		dev_err_probe(dev, ret, "parsing dt failed\n");
-		goto err_pltfm_free;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "parsing dt failed\n");
 
 	host->mmc_host_ops.start_signal_voltage_switch = sdhci_am654_start_signal_voltage_switch;
 	host->mmc_host_ops.execute_tuning = sdhci_am654_execute_tuning;
@@ -1001,8 +996,6 @@ static int sdhci_am654_probe(struct platform_device *pdev)
 	pm_runtime_disable(dev);
 pm_put:
 	pm_runtime_put_noidle(dev);
-err_pltfm_free:
-	sdhci_pltfm_free(pdev);
 	return ret;
 }
 
@@ -1021,7 +1014,6 @@ static void sdhci_am654_remove(struct platform_device *pdev)
 	clk_disable_unprepare(pltfm_host->clk);
 	pm_runtime_disable(dev);
 	pm_runtime_put_noidle(dev);
-	sdhci_pltfm_free(pdev);
 }
 
 #ifdef CONFIG_PM
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 34/35] mmc: sdhci_f_sdh30: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (32 preceding siblings ...)
  2025-05-29 13:25 ` [PATCH v2 33/35] mmc: sdhci_am654: " Binbin Zhou
@ 2025-05-29 13:26 ` Binbin Zhou
  2025-05-29 13:28 ` [PATCH v2 35/35] mmc: sdhci: Drop sdhci_free_host()/sdhci_pltfm_free() definitions Binbin Zhou
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 13:26 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou

Since the devm_mmc_alloc_host() helper is already in use,
sdhci_pltfm_free() is no longer needed.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci_f_sdh30.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/sdhci_f_sdh30.c b/drivers/mmc/host/sdhci_f_sdh30.c
index ee66e4f3683d..e9b934e159ad 100644
--- a/drivers/mmc/host/sdhci_f_sdh30.c
+++ b/drivers/mmc/host/sdhci_f_sdh30.c
@@ -133,20 +133,18 @@ static int sdhci_f_sdh30_probe(struct platform_device *pdev)
 
 	ret = mmc_of_parse(host->mmc);
 	if (ret)
-		goto err;
+		return ret;
 
 	if (dev_of_node(dev)) {
 		sdhci_get_of_property(pdev);
 
 		priv->clk_iface = devm_clk_get(&pdev->dev, "iface");
-		if (IS_ERR(priv->clk_iface)) {
-			ret = PTR_ERR(priv->clk_iface);
-			goto err;
-		}
+		if (IS_ERR(priv->clk_iface))
+			return PTR_ERR(priv->clk_iface);
 
 		ret = clk_prepare_enable(priv->clk_iface);
 		if (ret)
-			goto err;
+			return ret;
 
 		priv->clk = devm_clk_get(&pdev->dev, "core");
 		if (IS_ERR(priv->clk)) {
@@ -200,9 +198,6 @@ static int sdhci_f_sdh30_probe(struct platform_device *pdev)
 	clk_disable_unprepare(priv->clk);
 err_clk:
 	clk_disable_unprepare(priv->clk_iface);
-err:
-	sdhci_pltfm_free(pdev);
-
 	return ret;
 }
 
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH v2 35/35] mmc: sdhci: Drop sdhci_free_host()/sdhci_pltfm_free() definitions
  2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
                   ` (33 preceding siblings ...)
  2025-05-29 13:26 ` [PATCH v2 34/35] mmc: sdhci_f_sdh30: " Binbin Zhou
@ 2025-05-29 13:28 ` Binbin Zhou
  34 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-05-29 13:28 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Binbin Zhou

From now on, all calls to sdhci_free_host()/sdhci_pltfm_free() have been
cleaned up, so we can just delete their definitions.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdhci-pltfm.c | 5 -----
 drivers/mmc/host/sdhci-pltfm.h | 1 -
 drivers/mmc/host/sdhci.c       | 6 ------
 drivers/mmc/host/sdhci.h       | 1 -
 4 files changed, 13 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index aedbcd32713a..7f6ac636f040 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -146,11 +146,6 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
 }
 EXPORT_SYMBOL_GPL(sdhci_pltfm_init);
 
-void sdhci_pltfm_free(struct platform_device *pdev)
-{
-}
-EXPORT_SYMBOL_GPL(sdhci_pltfm_free);
-
 int sdhci_pltfm_init_and_add_host(struct platform_device *pdev,
 				  const struct sdhci_pltfm_data *pdata,
 				  size_t priv_size)
diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
index b81d5b0fd616..9c32e8a289d6 100644
--- a/drivers/mmc/host/sdhci-pltfm.h
+++ b/drivers/mmc/host/sdhci-pltfm.h
@@ -97,7 +97,6 @@ static inline void sdhci_get_of_property(struct platform_device *pdev)
 extern struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
 					  const struct sdhci_pltfm_data *pdata,
 					  size_t priv_size);
-extern void sdhci_pltfm_free(struct platform_device *pdev);
 
 extern int sdhci_pltfm_init_and_add_host(struct platform_device *pdev,
 					 const struct sdhci_pltfm_data *pdata,
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index ee5a5ae4db31..c40caa3f003f 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -5000,12 +5000,6 @@ void sdhci_remove_host(struct sdhci_host *host, int dead)
 
 EXPORT_SYMBOL_GPL(sdhci_remove_host);
 
-void sdhci_free_host(struct sdhci_host *host)
-{
-}
-
-EXPORT_SYMBOL_GPL(sdhci_free_host);
-
 /*****************************************************************************\
  *                                                                           *
  * Driver init/exit                                                          *
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index f9d65dd0f2b2..58291a6f093d 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -811,7 +811,6 @@ static inline u8 sdhci_readb(struct sdhci_host *host, int reg)
 #endif /* CONFIG_MMC_SDHCI_IO_ACCESSORS */
 
 struct sdhci_host *sdhci_alloc_host(struct device *dev, size_t priv_size);
-void sdhci_free_host(struct sdhci_host *host);
 
 static inline void *sdhci_priv(struct sdhci_host *host)
 {
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 22/35] mmc: sdhci-of-k1: Drop the use of sdhci_pltfm_free()
  2025-05-29 13:00 ` [PATCH v2 22/35] mmc: sdhci-of-k1: " Binbin Zhou
@ 2025-05-29 15:23   ` Yixun Lan
  0 siblings, 0 replies; 42+ messages in thread
From: Yixun Lan @ 2025-05-29 15:23 UTC (permalink / raw)
  To: Binbin Zhou
  Cc: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter, Huacai Chen,
	linux-mmc, Andrew Jeffery, linux-riscv, spacemit

On 21:00 Thu 29 May     , Binbin Zhou wrote:
> Since the devm_mmc_alloc_host() helper is already in use,
> sdhci_pltfm_free() is no longer needed.
> 
> Cc: Yixun Lan <dlan@gentoo.org>
> Cc: linux-riscv@lists.infradead.org
> Cc: spacemit@lists.linux.dev
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>

Reviewed-by: Yixun Lan <dlan@gentoo.org>

> ---
>  drivers/mmc/host/sdhci-of-k1.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-k1.c b/drivers/mmc/host/sdhci-of-k1.c
> index 6880d3e9ab62..026dc79af292 100644
> --- a/drivers/mmc/host/sdhci-of-k1.c
> +++ b/drivers/mmc/host/sdhci-of-k1.c
> @@ -286,7 +286,6 @@ static int spacemit_sdhci_probe(struct platform_device *pdev)
>  	return 0;
>  
>  err_pltfm:
> -	sdhci_pltfm_free(pdev);
>  	return ret;
>  }
>  
> -- 
> 2.47.1
> 

-- 
Yixun Lan (dlan)

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 32/35] mmc: sdhci-xenon: Drop the use of sdhci_pltfm_free()
  2025-05-29 13:24 ` [PATCH v2 32/35] mmc: sdhci-xenon: " Binbin Zhou
@ 2025-05-30  0:20   ` kernel test robot
  2025-06-02  6:48   ` Dan Carpenter
  1 sibling, 0 replies; 42+ messages in thread
From: kernel test robot @ 2025-05-30  0:20 UTC (permalink / raw)
  To: Binbin Zhou, Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: llvm, oe-kbuild-all, linux-mmc, Andrew Jeffery, Hu Ziji

Hi Binbin,

kernel test robot noticed the following build warnings:

[auto build test WARNING on d2c6acff6386f43ed307822454b970c831c48f1b]

url:    https://github.com/intel-lab-lkp/linux/commits/Binbin-Zhou/mmc-sdhci-Use-devm_mmc_alloc_host-helper/20250529-212928
base:   d2c6acff6386f43ed307822454b970c831c48f1b
patch link:    https://lore.kernel.org/r/b79920fa8bff8f7cf2f407863846446344d2eab7.1748515612.git.zhoubinbin%40loongson.cn
patch subject: [PATCH v2 32/35] mmc: sdhci-xenon: Drop the use of sdhci_pltfm_free()
config: arm-randconfig-004-20250530 (https://download.01.org/0day-ci/archive/20250530/202505300815.tjQRQD6z-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250530/202505300815.tjQRQD6z-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505300815.tjQRQD6z-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/mmc/host/sdhci-xenon.c:536:59: warning: variable 'err' is uninitialized when used here [-Wuninitialized]
     536 |                         dev_err(&pdev->dev, "Failed to setup input clk: %d\n", err);
         |                                                                                ^~~
   include/linux/dev_printk.h:154:65: note: expanded from macro 'dev_err'
     154 |         dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                                        ^~~~~~~~~~~
   include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                                     ^~~~~~~~~~~
   drivers/mmc/host/sdhci-xenon.c:515:9: note: initialize the variable 'err' to silence this warning
     515 |         int err;
         |                ^
         |                 = 0
   1 warning generated.


vim +/err +536 drivers/mmc/host/sdhci-xenon.c

3a3748dba881ed Hu Ziji         2017-03-30  508  
3a3748dba881ed Hu Ziji         2017-03-30  509  static int xenon_probe(struct platform_device *pdev)
3a3748dba881ed Hu Ziji         2017-03-30  510  {
3a3748dba881ed Hu Ziji         2017-03-30  511  	struct sdhci_pltfm_host *pltfm_host;
1542488031deed Marcin Wojtas   2020-12-04  512  	struct device *dev = &pdev->dev;
3a3748dba881ed Hu Ziji         2017-03-30  513  	struct sdhci_host *host;
bb16ea1742c8f3 Gregory CLEMENT 2017-10-02  514  	struct xenon_priv *priv;
3a3748dba881ed Hu Ziji         2017-03-30  515  	int err;
3a3748dba881ed Hu Ziji         2017-03-30  516  
3a3748dba881ed Hu Ziji         2017-03-30  517  	host = sdhci_pltfm_init(pdev, &sdhci_xenon_pdata,
3a3748dba881ed Hu Ziji         2017-03-30  518  				sizeof(struct xenon_priv));
3a3748dba881ed Hu Ziji         2017-03-30  519  	if (IS_ERR(host))
3a3748dba881ed Hu Ziji         2017-03-30  520  		return PTR_ERR(host);
3a3748dba881ed Hu Ziji         2017-03-30  521  
3a3748dba881ed Hu Ziji         2017-03-30  522  	pltfm_host = sdhci_priv(host);
bb16ea1742c8f3 Gregory CLEMENT 2017-10-02  523  	priv = sdhci_pltfm_priv(pltfm_host);
3a3748dba881ed Hu Ziji         2017-03-30  524  
f75fda3730728e Marcin Wojtas   2020-12-04  525  	priv->hw_version = (unsigned long)device_get_match_data(&pdev->dev);
f75fda3730728e Marcin Wojtas   2020-12-04  526  
3a3748dba881ed Hu Ziji         2017-03-30  527  	/*
3a3748dba881ed Hu Ziji         2017-03-30  528  	 * Link Xenon specific mmc_host_ops function,
3a3748dba881ed Hu Ziji         2017-03-30  529  	 * to replace standard ones in sdhci_ops.
3a3748dba881ed Hu Ziji         2017-03-30  530  	 */
3a3748dba881ed Hu Ziji         2017-03-30  531  	xenon_replace_mmc_host_ops(host);
3a3748dba881ed Hu Ziji         2017-03-30  532  
1542488031deed Marcin Wojtas   2020-12-04  533  	if (dev->of_node) {
3a3748dba881ed Hu Ziji         2017-03-30  534  		pltfm_host->clk = devm_clk_get(&pdev->dev, "core");
3a3748dba881ed Hu Ziji         2017-03-30  535  		if (IS_ERR(pltfm_host->clk)) {
3a3748dba881ed Hu Ziji         2017-03-30 @536  			dev_err(&pdev->dev, "Failed to setup input clk: %d\n", err);
6773eb1cf68bcb Binbin Zhou     2025-05-29  537  			return PTR_ERR(pltfm_host->clk);
3a3748dba881ed Hu Ziji         2017-03-30  538  		}
3a3748dba881ed Hu Ziji         2017-03-30  539  		err = clk_prepare_enable(pltfm_host->clk);
3a3748dba881ed Hu Ziji         2017-03-30  540  		if (err)
6773eb1cf68bcb Binbin Zhou     2025-05-29  541  			return err;
3a3748dba881ed Hu Ziji         2017-03-30  542  
bb16ea1742c8f3 Gregory CLEMENT 2017-10-02  543  		priv->axi_clk = devm_clk_get(&pdev->dev, "axi");
bb16ea1742c8f3 Gregory CLEMENT 2017-10-02  544  		if (IS_ERR(priv->axi_clk)) {
bb16ea1742c8f3 Gregory CLEMENT 2017-10-02  545  			err = PTR_ERR(priv->axi_clk);
bb16ea1742c8f3 Gregory CLEMENT 2017-10-02  546  			if (err == -EPROBE_DEFER)
bb16ea1742c8f3 Gregory CLEMENT 2017-10-02  547  				goto err_clk;
bb16ea1742c8f3 Gregory CLEMENT 2017-10-02  548  		} else {
bb16ea1742c8f3 Gregory CLEMENT 2017-10-02  549  			err = clk_prepare_enable(priv->axi_clk);
3a3748dba881ed Hu Ziji         2017-03-30  550  			if (err)
3a3748dba881ed Hu Ziji         2017-03-30  551  				goto err_clk;
bb16ea1742c8f3 Gregory CLEMENT 2017-10-02  552  		}
1542488031deed Marcin Wojtas   2020-12-04  553  	}
bb16ea1742c8f3 Gregory CLEMENT 2017-10-02  554  
bb16ea1742c8f3 Gregory CLEMENT 2017-10-02  555  	err = mmc_of_parse(host->mmc);
bb16ea1742c8f3 Gregory CLEMENT 2017-10-02  556  	if (err)
bb16ea1742c8f3 Gregory CLEMENT 2017-10-02  557  		goto err_clk_axi;
3a3748dba881ed Hu Ziji         2017-03-30  558  
f29bf660bf4137 Marcin Wojtas   2020-12-04  559  	sdhci_get_property(pdev);
3a3748dba881ed Hu Ziji         2017-03-30  560  
3a3748dba881ed Hu Ziji         2017-03-30  561  	xenon_set_acg(host, false);
3a3748dba881ed Hu Ziji         2017-03-30  562  
f29bf660bf4137 Marcin Wojtas   2020-12-04  563  	/* Xenon specific parameters parse */
f29bf660bf4137 Marcin Wojtas   2020-12-04  564  	err = xenon_probe_params(pdev);
3a3748dba881ed Hu Ziji         2017-03-30  565  	if (err)
bb16ea1742c8f3 Gregory CLEMENT 2017-10-02  566  		goto err_clk_axi;
3a3748dba881ed Hu Ziji         2017-03-30  567  
3a3748dba881ed Hu Ziji         2017-03-30  568  	err = xenon_sdhc_prepare(host);
3a3748dba881ed Hu Ziji         2017-03-30  569  	if (err)
bb16ea1742c8f3 Gregory CLEMENT 2017-10-02  570  		goto err_clk_axi;
3a3748dba881ed Hu Ziji         2017-03-30  571  
a027b2c5fed788 Zhoujie Wu      2017-08-29  572  	pm_runtime_get_noresume(&pdev->dev);
a027b2c5fed788 Zhoujie Wu      2017-08-29  573  	pm_runtime_set_active(&pdev->dev);
a027b2c5fed788 Zhoujie Wu      2017-08-29  574  	pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
a027b2c5fed788 Zhoujie Wu      2017-08-29  575  	pm_runtime_use_autosuspend(&pdev->dev);
a027b2c5fed788 Zhoujie Wu      2017-08-29  576  	pm_runtime_enable(&pdev->dev);
a027b2c5fed788 Zhoujie Wu      2017-08-29  577  	pm_suspend_ignore_children(&pdev->dev, 1);
a027b2c5fed788 Zhoujie Wu      2017-08-29  578  
3a3748dba881ed Hu Ziji         2017-03-30  579  	err = sdhci_add_host(host);
3a3748dba881ed Hu Ziji         2017-03-30  580  	if (err)
3a3748dba881ed Hu Ziji         2017-03-30  581  		goto remove_sdhc;
3a3748dba881ed Hu Ziji         2017-03-30  582  
a027b2c5fed788 Zhoujie Wu      2017-08-29  583  	pm_runtime_put_autosuspend(&pdev->dev);
5d40213347480e Elad Nachman    2024-01-04  584  	/*
5d40213347480e Elad Nachman    2024-01-04  585  	 * If we previously detected AC5 with over 2GB of memory,
5d40213347480e Elad Nachman    2024-01-04  586  	 * then we disable ADMA and 64-bit DMA.
5d40213347480e Elad Nachman    2024-01-04  587  	 * This means generic SDHCI driver has set the DMA mask to
5d40213347480e Elad Nachman    2024-01-04  588  	 * 32-bit. Since DDR starts at 0x2_0000_0000, we must use
5d40213347480e Elad Nachman    2024-01-04  589  	 * 34-bit DMA mask to access this DDR memory:
5d40213347480e Elad Nachman    2024-01-04  590  	 */
5d40213347480e Elad Nachman    2024-01-04  591  	if (priv->hw_version == XENON_AC5 &&
5d40213347480e Elad Nachman    2024-01-04  592  	    host->quirks2 & SDHCI_QUIRK2_BROKEN_64_BIT_DMA)
5d40213347480e Elad Nachman    2024-01-04  593  		dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
a027b2c5fed788 Zhoujie Wu      2017-08-29  594  
3a3748dba881ed Hu Ziji         2017-03-30  595  	return 0;
3a3748dba881ed Hu Ziji         2017-03-30  596  
3a3748dba881ed Hu Ziji         2017-03-30  597  remove_sdhc:
a027b2c5fed788 Zhoujie Wu      2017-08-29  598  	pm_runtime_disable(&pdev->dev);
a027b2c5fed788 Zhoujie Wu      2017-08-29  599  	pm_runtime_put_noidle(&pdev->dev);
3a3748dba881ed Hu Ziji         2017-03-30  600  	xenon_sdhc_unprepare(host);
bb16ea1742c8f3 Gregory CLEMENT 2017-10-02  601  err_clk_axi:
bb16ea1742c8f3 Gregory CLEMENT 2017-10-02  602  	clk_disable_unprepare(priv->axi_clk);
3a3748dba881ed Hu Ziji         2017-03-30  603  err_clk:
3a3748dba881ed Hu Ziji         2017-03-30  604  	clk_disable_unprepare(pltfm_host->clk);
3a3748dba881ed Hu Ziji         2017-03-30  605  	return err;
3a3748dba881ed Hu Ziji         2017-03-30  606  }
3a3748dba881ed Hu Ziji         2017-03-30  607  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 42+ messages in thread

* RE: [PATCH v2 12/35] mmc: sdhci-esdhc-imx: Drop the use of sdhci_pltfm_free()
  2025-05-29 12:59 ` [PATCH v2 12/35] mmc: sdhci-esdhc-imx: " Binbin Zhou
@ 2025-05-30  2:31   ` Bough Chen
  0 siblings, 0 replies; 42+ messages in thread
From: Bough Chen @ 2025-05-30  2:31 UTC (permalink / raw)
  To: Binbin Zhou, Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc@vger.kernel.org, Andrew Jeffery, Shawn Guo,
	Sascha Hauer, Fabio Estevam, imx@lists.linux.dev

> -----Original Message-----
> From: Binbin Zhou <zhoubinbin@loongson.cn>
> Sent: 2025年5月29日 20:59
> To: Binbin Zhou <zhoubb.aaron@gmail.com>; Huacai Chen
> <chenhuacai@loongson.cn>; Ulf Hansson <ulf.hansson@linaro.org>; Adrian
> Hunter <adrian.hunter@intel.com>
> Cc: Huacai Chen <chenhuacai@kernel.org>; linux-mmc@vger.kernel.org;
> Andrew Jeffery <andrew@codeconstruct.com.au>; Binbin Zhou
> <zhoubinbin@loongson.cn>; Bough Chen <haibo.chen@nxp.com>; Shawn Guo
> <shawnguo@kernel.org>; Sascha Hauer <s.hauer@pengutronix.de>; Fabio
> Estevam <festevam@gmail.com>; imx@lists.linux.dev
> Subject: [PATCH v2 12/35] mmc: sdhci-esdhc-imx: Drop the use of
> sdhci_pltfm_free()
> 
> Since the devm_mmc_alloc_host() helper is already in use,
> sdhci_pltfm_free() is no longer needed.

Reviewed-by: Haibo Chen <haibo.chen@nxp.com>

Thanks
Haibo
> 
> Cc: Haibo Chen <haibo.chen@nxp.com>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: imx@lists.linux.dev
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c
> b/drivers/mmc/host/sdhci-esdhc-imx.c
> index ac187a8798b7..011b60d21a80 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -1973,7 +1973,6 @@ static int sdhci_esdhc_imx_probe(struct
> platform_device *pdev)
>  free_sdhci:
>  	if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS)
>  		cpu_latency_qos_remove_request(&imx_data->pm_qos_req);
> -	sdhci_pltfm_free(pdev);
>  	return err;
>  }
> 
> @@ -1997,8 +1996,6 @@ static void sdhci_esdhc_imx_remove(struct
> platform_device *pdev)
> 
>  	if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS)
>  		cpu_latency_qos_remove_request(&imx_data->pm_qos_req);
> -
> -	sdhci_pltfm_free(pdev);
>  }
> 
>  #ifdef CONFIG_PM_SLEEP
> --
> 2.47.1


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 32/35] mmc: sdhci-xenon: Drop the use of sdhci_pltfm_free()
  2025-05-29 13:24 ` [PATCH v2 32/35] mmc: sdhci-xenon: " Binbin Zhou
  2025-05-30  0:20   ` kernel test robot
@ 2025-06-02  6:48   ` Dan Carpenter
  1 sibling, 0 replies; 42+ messages in thread
From: Dan Carpenter @ 2025-06-02  6:48 UTC (permalink / raw)
  To: oe-kbuild, Binbin Zhou, Binbin Zhou, Huacai Chen, Ulf Hansson,
	Adrian Hunter
  Cc: lkp, oe-kbuild-all, linux-mmc, Andrew Jeffery, Hu Ziji

Hi Binbin,

kernel test robot noticed the following build warnings:

url:    https://github.com/intel-lab-lkp/linux/commits/Binbin-Zhou/mmc-sdhci-Use-devm_mmc_alloc_host-helper/20250529-212928
base:   d2c6acff6386f43ed307822454b970c831c48f1b
patch link:    https://lore.kernel.org/r/b79920fa8bff8f7cf2f407863846446344d2eab7.1748515612.git.zhoubinbin%40loongson.cn
patch subject: [PATCH v2 32/35] mmc: sdhci-xenon: Drop the use of sdhci_pltfm_free()
config: i386-randconfig-141-20250530 (https://download.01.org/0day-ci/archive/20250531/202505310526.Nh371Swn-lkp@intel.com/config)
compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202505310526.Nh371Swn-lkp@intel.com/

smatch warnings:
drivers/mmc/host/sdhci-xenon.c:536 xenon_probe() error: uninitialized symbol 'err'.

vim +/err +536 drivers/mmc/host/sdhci-xenon.c

3a3748dba881ed Hu Ziji         2017-03-30  509  static int xenon_probe(struct platform_device *pdev)
3a3748dba881ed Hu Ziji         2017-03-30  510  {
3a3748dba881ed Hu Ziji         2017-03-30  511  	struct sdhci_pltfm_host *pltfm_host;
1542488031deed Marcin Wojtas   2020-12-04  512  	struct device *dev = &pdev->dev;
3a3748dba881ed Hu Ziji         2017-03-30  513  	struct sdhci_host *host;
bb16ea1742c8f3 Gregory CLEMENT 2017-10-02  514  	struct xenon_priv *priv;
3a3748dba881ed Hu Ziji         2017-03-30  515  	int err;
3a3748dba881ed Hu Ziji         2017-03-30  516  
3a3748dba881ed Hu Ziji         2017-03-30  517  	host = sdhci_pltfm_init(pdev, &sdhci_xenon_pdata,
3a3748dba881ed Hu Ziji         2017-03-30  518  				sizeof(struct xenon_priv));
3a3748dba881ed Hu Ziji         2017-03-30  519  	if (IS_ERR(host))
3a3748dba881ed Hu Ziji         2017-03-30  520  		return PTR_ERR(host);
3a3748dba881ed Hu Ziji         2017-03-30  521  
3a3748dba881ed Hu Ziji         2017-03-30  522  	pltfm_host = sdhci_priv(host);
bb16ea1742c8f3 Gregory CLEMENT 2017-10-02  523  	priv = sdhci_pltfm_priv(pltfm_host);
3a3748dba881ed Hu Ziji         2017-03-30  524  
f75fda3730728e Marcin Wojtas   2020-12-04  525  	priv->hw_version = (unsigned long)device_get_match_data(&pdev->dev);
f75fda3730728e Marcin Wojtas   2020-12-04  526  
3a3748dba881ed Hu Ziji         2017-03-30  527  	/*
3a3748dba881ed Hu Ziji         2017-03-30  528  	 * Link Xenon specific mmc_host_ops function,
3a3748dba881ed Hu Ziji         2017-03-30  529  	 * to replace standard ones in sdhci_ops.
3a3748dba881ed Hu Ziji         2017-03-30  530  	 */
3a3748dba881ed Hu Ziji         2017-03-30  531  	xenon_replace_mmc_host_ops(host);
3a3748dba881ed Hu Ziji         2017-03-30  532  
1542488031deed Marcin Wojtas   2020-12-04  533  	if (dev->of_node) {
3a3748dba881ed Hu Ziji         2017-03-30  534  		pltfm_host->clk = devm_clk_get(&pdev->dev, "core");
3a3748dba881ed Hu Ziji         2017-03-30  535  		if (IS_ERR(pltfm_host->clk)) {
3a3748dba881ed Hu Ziji         2017-03-30 @536  			dev_err(&pdev->dev, "Failed to setup input clk: %d\n", err);
                                                                                                                               ^^^
Use %pe and pass pltfm_host->clk as the error code.

6773eb1cf68bcb Binbin Zhou     2025-05-29  537  			return PTR_ERR(pltfm_host->clk);
3a3748dba881ed Hu Ziji         2017-03-30  538  		}
3a3748dba881ed Hu Ziji         2017-03-30  539  		err = clk_prepare_enable(pltfm_host->clk);
3a3748dba881ed Hu Ziji         2017-03-30  540  		if (err)
6773eb1cf68bcb Binbin Zhou     2025-05-29  541  			return err;

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 19/35] mmc: sdhci-of-at91: Drop the use of sdhci_pltfm_free()
  2025-05-29 13:00 ` [PATCH v2 19/35] mmc: sdhci-of-at91: " Binbin Zhou
@ 2025-06-02 16:09   ` Aubin Constans
  2025-06-03  7:25     ` Binbin Zhou
  0 siblings, 1 reply; 42+ messages in thread
From: Aubin Constans @ 2025-06-02 16:09 UTC (permalink / raw)
  To: Binbin Zhou, Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
  Cc: Huacai Chen, linux-mmc, Andrew Jeffery, Eugen Hristev,
	Nicolas Ferre, Alexandre Belloni, Claudiu Beznea

Hi Binbin,

Thank you for the change.

On 29/05/2025 15:00, Binbin Zhou wrote:
> Since the devm_mmc_alloc_host() helper is already in use,
> sdhci_pltfm_free() is no longer needed.
> 
> Cc: Aubin Constans <aubin.constans@microchip.com>
> Cc: Eugen Hristev <eugen.hristev@linaro.org>
> Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: Claudiu Beznea <claudiu.beznea@tuxon.dev>
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> ---
>   drivers/mmc/host/sdhci-of-at91.c | 23 ++++++++---------------
>   1 file changed, 8 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> index 97988ed37467..0b7d7db79139 100644
> --- a/drivers/mmc/host/sdhci-of-at91.c
> +++ b/drivers/mmc/host/sdhci-of-at91.c
> @@ -337,28 +337,23 @@ static int sdhci_at91_probe(struct platform_device *pdev)
>                          priv->mainck = NULL;
>                  } else {
>                          dev_err(&pdev->dev, "failed to get baseclk\n");
> -                       ret = PTR_ERR(priv->mainck);
> -                       goto sdhci_pltfm_free;
> +                       return PTR_ERR(priv->mainck);
>                  }
>          }

For consistency with the changes below, please use dev_err_probe() as well.
Doing so, you can remove the brackets in both if/else blocks. Or preserve these
brackets may you wish to keep the changes minimal.

Regards
Aubin

> 
>          priv->hclock = devm_clk_get(&pdev->dev, "hclock");
> -       if (IS_ERR(priv->hclock)) {
> -               dev_err(&pdev->dev, "failed to get hclock\n");
> -               ret = PTR_ERR(priv->hclock);
> -               goto sdhci_pltfm_free;
> -       }
> +       if (IS_ERR(priv->hclock))
> +               return dev_err_probe(&pdev->dev, PTR_ERR(priv->hclock),
> +                                    "failed to get hclock\n");
> 
>          priv->gck = devm_clk_get(&pdev->dev, "multclk");
> -       if (IS_ERR(priv->gck)) {
> -               dev_err(&pdev->dev, "failed to get multclk\n");
> -               ret = PTR_ERR(priv->gck);
> -               goto sdhci_pltfm_free;
> -       }
> +       if (IS_ERR(priv->gck))
> +               return dev_err_probe(&pdev->dev, PTR_ERR(priv->gck),
> +                                    "failed to get multclk\n");
> 
>          ret = sdhci_at91_set_clks_presets(&pdev->dev);
>          if (ret)
> -               goto sdhci_pltfm_free;
> +               return ret;
> 
>          priv->restore_needed = false;
> 
> @@ -438,8 +433,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
>          clk_disable_unprepare(priv->gck);
>          clk_disable_unprepare(priv->mainck);
>          clk_disable_unprepare(priv->hclock);
> -sdhci_pltfm_free:
> -       sdhci_pltfm_free(pdev);
>          return ret;
>   }
> 
> --
> 2.47.1
> 


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH v2 19/35] mmc: sdhci-of-at91: Drop the use of sdhci_pltfm_free()
  2025-06-02 16:09   ` Aubin Constans
@ 2025-06-03  7:25     ` Binbin Zhou
  0 siblings, 0 replies; 42+ messages in thread
From: Binbin Zhou @ 2025-06-03  7:25 UTC (permalink / raw)
  To: Aubin Constans
  Cc: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter, Huacai Chen,
	linux-mmc, Andrew Jeffery, Eugen Hristev, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea

Hi Aubin:

Thanks for your reply.

On Tue, Jun 3, 2025 at 12:09 AM Aubin Constans
<aubin.constans@microchip.com> wrote:
>
> Hi Binbin,
>
> Thank you for the change.
>
> On 29/05/2025 15:00, Binbin Zhou wrote:
> > Since the devm_mmc_alloc_host() helper is already in use,
> > sdhci_pltfm_free() is no longer needed.
> >
> > Cc: Aubin Constans <aubin.constans@microchip.com>
> > Cc: Eugen Hristev <eugen.hristev@linaro.org>
> > Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
> > Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> > Cc: Claudiu Beznea <claudiu.beznea@tuxon.dev>
> > Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> > ---
> >   drivers/mmc/host/sdhci-of-at91.c | 23 ++++++++---------------
> >   1 file changed, 8 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> > index 97988ed37467..0b7d7db79139 100644
> > --- a/drivers/mmc/host/sdhci-of-at91.c
> > +++ b/drivers/mmc/host/sdhci-of-at91.c
> > @@ -337,28 +337,23 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> >                          priv->mainck = NULL;
> >                  } else {
> >                          dev_err(&pdev->dev, "failed to get baseclk\n");
> > -                       ret = PTR_ERR(priv->mainck);
> > -                       goto sdhci_pltfm_free;
> > +                       return PTR_ERR(priv->mainck);
> >                  }
> >          }
>
> For consistency with the changes below, please use dev_err_probe() as well.
> Doing so, you can remove the brackets in both if/else blocks. Or preserve these
> brackets may you wish to keep the changes minimal.

I will use dev_err_probe() to cleanup the code.
>
> Regards
> Aubin
>
> >
> >          priv->hclock = devm_clk_get(&pdev->dev, "hclock");
> > -       if (IS_ERR(priv->hclock)) {
> > -               dev_err(&pdev->dev, "failed to get hclock\n");
> > -               ret = PTR_ERR(priv->hclock);
> > -               goto sdhci_pltfm_free;
> > -       }
> > +       if (IS_ERR(priv->hclock))
> > +               return dev_err_probe(&pdev->dev, PTR_ERR(priv->hclock),
> > +                                    "failed to get hclock\n");
> >
> >          priv->gck = devm_clk_get(&pdev->dev, "multclk");
> > -       if (IS_ERR(priv->gck)) {
> > -               dev_err(&pdev->dev, "failed to get multclk\n");
> > -               ret = PTR_ERR(priv->gck);
> > -               goto sdhci_pltfm_free;
> > -       }
> > +       if (IS_ERR(priv->gck))
> > +               return dev_err_probe(&pdev->dev, PTR_ERR(priv->gck),
> > +                                    "failed to get multclk\n");
> >
> >          ret = sdhci_at91_set_clks_presets(&pdev->dev);
> >          if (ret)
> > -               goto sdhci_pltfm_free;
> > +               return ret;
> >
> >          priv->restore_needed = false;
> >
> > @@ -438,8 +433,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> >          clk_disable_unprepare(priv->gck);
> >          clk_disable_unprepare(priv->mainck);
> >          clk_disable_unprepare(priv->hclock);
> > -sdhci_pltfm_free:
> > -       sdhci_pltfm_free(pdev);
> >          return ret;
> >   }
> >
> > --
> > 2.47.1
> >
>

-- 
Thanks.
Binbin

^ permalink raw reply	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2025-06-03  7:25 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-29 12:56 [PATCH v2 00/35] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
2025-05-29 12:57 ` [PATCH v2 01/35] mmc: sdhci: Use devm_mmc_alloc_host() helper Binbin Zhou
2025-05-29 12:58 ` [PATCH v2 02/35] mmc: sdhci-acpi: Drop the use of sdhci_free_host() Binbin Zhou
2025-05-29 12:58 ` [PATCH v2 03/35] mmc: sdhci-milbeaut: " Binbin Zhou
2025-05-29 12:58 ` [PATCH v2 04/35] mmc: sdhci-pci: " Binbin Zhou
2025-05-29 12:58 ` [PATCH v2 05/35] mmc: sdhci-s3c: " Binbin Zhou
2025-05-29 12:58 ` [PATCH v2 06/35] mmc: sdhci-spear: " Binbin Zhou
2025-05-29 12:58 ` [PATCH v2 07/35] mmc: sdhci-pltfm: Drop the use of sdhci_pltfm_free() Binbin Zhou
2025-05-29 12:59 ` [PATCH v2 08/35] mmc: sdhci-bcm-kona: " Binbin Zhou
2025-05-29 12:59 ` [PATCH v2 09/35] mmc: sdhci-brcmstb: " Binbin Zhou
2025-05-29 12:59 ` [PATCH v2 10/35] mmc: sdhci-cadence: " Binbin Zhou
2025-05-29 12:59 ` [PATCH v2 11/35] mmc: sdhci-dove: " Binbin Zhou
2025-05-29 12:59 ` [PATCH v2 12/35] mmc: sdhci-esdhc-imx: " Binbin Zhou
2025-05-30  2:31   ` Bough Chen
2025-05-29 12:59 ` [PATCH v2 13/35] mmc: sdhci-esdhc-mcf: " Binbin Zhou
2025-05-29 12:59 ` [PATCH v2 14/35] mmc: sdhci-iproc: " Binbin Zhou
2025-05-29 12:59 ` [PATCH v2 15/35] mmc: sdhci-msm: " Binbin Zhou
2025-05-29 12:59 ` [PATCH v2 16/35] mmc: sdhci-npcm: " Binbin Zhou
2025-05-29 12:59 ` [PATCH v2 17/35] mmc: sdhci-of-arasan: " Binbin Zhou
2025-05-29 13:00 ` [PATCH v2 18/35] mmc: sdhci-of-aspeed: " Binbin Zhou
2025-05-29 13:00 ` [PATCH v2 19/35] mmc: sdhci-of-at91: " Binbin Zhou
2025-06-02 16:09   ` Aubin Constans
2025-06-03  7:25     ` Binbin Zhou
2025-05-29 13:00 ` [PATCH v2 20/35] mmc: sdhci-of-dwcmshc: " Binbin Zhou
2025-05-29 13:00 ` [PATCH v2 21/35] mmc: sdhci-of-esdhc: " Binbin Zhou
2025-05-29 13:00 ` [PATCH v2 22/35] mmc: sdhci-of-k1: " Binbin Zhou
2025-05-29 15:23   ` Yixun Lan
2025-05-29 13:11 ` [PATCH v2 23/35] mmc: sdhci-of-ma35d1: " Binbin Zhou
2025-05-29 13:14 ` [PATCH v2 24/35] mmc: sdhci-of-sparx5: " Binbin Zhou
2025-05-29 13:16 ` [PATCH v2 25/35] mmc: sdhci-omap: " Binbin Zhou
2025-05-29 13:17 ` [PATCH v2 26/35] mmc: sdhci-pic32: " Binbin Zhou
2025-05-29 13:19 ` [PATCH v2 27/35] mmc: sdhci-pxav2: " Binbin Zhou
2025-05-29 13:20 ` [PATCH v2 28/35] mmc: sdhci-pxav3: " Binbin Zhou
2025-05-29 13:21 ` [PATCH v2 29/35] mmc: sdhci-sprd: " Binbin Zhou
2025-05-29 13:22 ` [PATCH v2 30/35] mmc: sdhci-st: " Binbin Zhou
2025-05-29 13:23 ` [PATCH v2 31/35] mmc: sdhci-tegra: " Binbin Zhou
2025-05-29 13:24 ` [PATCH v2 32/35] mmc: sdhci-xenon: " Binbin Zhou
2025-05-30  0:20   ` kernel test robot
2025-06-02  6:48   ` Dan Carpenter
2025-05-29 13:25 ` [PATCH v2 33/35] mmc: sdhci_am654: " Binbin Zhou
2025-05-29 13:26 ` [PATCH v2 34/35] mmc: sdhci_f_sdh30: " Binbin Zhou
2025-05-29 13:28 ` [PATCH v2 35/35] mmc: sdhci: Drop sdhci_free_host()/sdhci_pltfm_free() definitions Binbin Zhou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).