* [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage
@ 2025-05-26 6:05 Binbin Zhou
2025-05-26 6:05 ` [PATCH 01/34] mmc: sdhci: Use devm_mmc_alloc_host() helper Binbin Zhou
` (32 more replies)
0 siblings, 33 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:05 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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.
Binbin Zhou (34):
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()
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 | 15 ++++---------
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, 133 insertions(+), 359 deletions(-)
base-commit: aee11c5ac9a0949e1af7534e30dda4ffa122eb97
--
2.47.1
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH 01/34] mmc: sdhci: Use devm_mmc_alloc_host() helper
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
@ 2025-05-26 6:05 ` Binbin Zhou
2025-05-26 6:27 ` Adrian Hunter
2025-05-26 6:05 ` [PATCH 02/34] mmc: sdhci-acpi: Drop the use of sdhci_free_host() Binbin Zhou
` (31 subsequent siblings)
32 siblings, 1 reply; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:05 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, Binbin Zhou
Use new function devm_mmc_alloc_host() to simplify the code.
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
drivers/mmc/host/sdhci.c | 9 +--------
drivers/mmc/host/sdhci.h | 1 -
2 files changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 32fa0b2bb912..c40caa3f003f 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);
@@ -5000,13 +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)
-{
- mmc_free_host(host->mmc);
-}
-
-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] 45+ messages in thread
* [PATCH 02/34] mmc: sdhci-acpi: Drop the use of sdhci_free_host()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
2025-05-26 6:05 ` [PATCH 01/34] mmc: sdhci: Use devm_mmc_alloc_host() helper Binbin Zhou
@ 2025-05-26 6:05 ` Binbin Zhou
2025-05-26 6:05 ` [PATCH 03/34] mmc: sdhci-milbeaut: " Binbin Zhou
` (30 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:05 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 03/34] mmc: sdhci-milbeaut: Drop the use of sdhci_free_host()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
2025-05-26 6:05 ` [PATCH 01/34] mmc: sdhci: Use devm_mmc_alloc_host() helper Binbin Zhou
2025-05-26 6:05 ` [PATCH 02/34] mmc: sdhci-acpi: Drop the use of sdhci_free_host() Binbin Zhou
@ 2025-05-26 6:05 ` Binbin Zhou
2025-05-26 6:05 ` [PATCH 04/34] mmc: sdhci-pci: " Binbin Zhou
` (29 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:05 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 04/34] mmc: sdhci-pci: Drop the use of sdhci_free_host()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (2 preceding siblings ...)
2025-05-26 6:05 ` [PATCH 03/34] mmc: sdhci-milbeaut: " Binbin Zhou
@ 2025-05-26 6:05 ` Binbin Zhou
2025-05-26 6:05 ` [PATCH 05/34] mmc: sdhci-s3c: " Binbin Zhou
` (28 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:05 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 05/34] mmc: sdhci-s3c: Drop the use of sdhci_free_host()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (3 preceding siblings ...)
2025-05-26 6:05 ` [PATCH 04/34] mmc: sdhci-pci: " Binbin Zhou
@ 2025-05-26 6:05 ` Binbin Zhou
2025-05-26 6:05 ` [PATCH 06/34] mmc: sdhci-spear: " Binbin Zhou
` (27 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:05 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 06/34] mmc: sdhci-spear: Drop the use of sdhci_free_host()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (4 preceding siblings ...)
2025-05-26 6:05 ` [PATCH 05/34] mmc: sdhci-s3c: " Binbin Zhou
@ 2025-05-26 6:05 ` Binbin Zhou
2025-05-26 6:05 ` [PATCH 07/34] mmc: sdhci-pltfm: Drop the use of sdhci_pltfm_free() Binbin Zhou
` (26 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:05 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 07/34] mmc: sdhci-pltfm: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (5 preceding siblings ...)
2025-05-26 6:05 ` [PATCH 06/34] mmc: sdhci-spear: " Binbin Zhou
@ 2025-05-26 6:05 ` Binbin Zhou
2025-05-26 6:05 ` [PATCH 08/34] mmc: sdhci-bcm-kona: " Binbin Zhou
` (25 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:05 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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-pltfm.c | 16 +---------------
drivers/mmc/host/sdhci-pltfm.h | 1 -
2 files changed, 1 insertion(+), 16 deletions(-)
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index 62753d72198a..7f6ac636f040 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -146,20 +146,11 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
}
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);
-
int sdhci_pltfm_init_and_add_host(struct platform_device *pdev,
const struct sdhci_pltfm_data *pdata,
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 +158,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 +168,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);
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,
--
2.47.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH 08/34] mmc: sdhci-bcm-kona: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (6 preceding siblings ...)
2025-05-26 6:05 ` [PATCH 07/34] mmc: sdhci-pltfm: Drop the use of sdhci_pltfm_free() Binbin Zhou
@ 2025-05-26 6:05 ` Binbin Zhou
2025-05-26 6:05 ` [PATCH 09/34] mmc: sdhci-brcmstb: " Binbin Zhou
` (24 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:05 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 09/34] mmc: sdhci-brcmstb: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (7 preceding siblings ...)
2025-05-26 6:05 ` [PATCH 08/34] mmc: sdhci-bcm-kona: " Binbin Zhou
@ 2025-05-26 6:05 ` Binbin Zhou
2025-05-26 6:06 ` [PATCH 10/34] mmc: sdhci-cadence: " Binbin Zhou
` (23 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:05 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 10/34] mmc: sdhci-cadence: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (8 preceding siblings ...)
2025-05-26 6:05 ` [PATCH 09/34] mmc: sdhci-brcmstb: " Binbin Zhou
@ 2025-05-26 6:06 ` Binbin Zhou
2025-05-26 6:06 ` [PATCH 11/34] mmc: sdhci-dove: " Binbin Zhou
` (22 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:06 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 11/34] mmc: sdhci-dove: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (9 preceding siblings ...)
2025-05-26 6:06 ` [PATCH 10/34] mmc: sdhci-cadence: " Binbin Zhou
@ 2025-05-26 6:06 ` Binbin Zhou
2025-05-26 6:06 ` [PATCH 12/34] mmc: sdhci-esdhc-imx: " Binbin Zhou
` (21 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:06 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 12/34] mmc: sdhci-esdhc-imx: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (10 preceding siblings ...)
2025-05-26 6:06 ` [PATCH 11/34] mmc: sdhci-dove: " Binbin Zhou
@ 2025-05-26 6:06 ` Binbin Zhou
2025-05-26 6:06 ` [PATCH 13/34] mmc: sdhci-esdhc-mcf: " Binbin Zhou
` (20 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:06 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 13/34] mmc: sdhci-esdhc-mcf: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (11 preceding siblings ...)
2025-05-26 6:06 ` [PATCH 12/34] mmc: sdhci-esdhc-imx: " Binbin Zhou
@ 2025-05-26 6:06 ` Binbin Zhou
2025-05-28 8:00 ` Angelo Dureghello
2025-05-28 8:05 ` Angelo Dureghello
2025-05-26 6:06 ` [PATCH 14/34] mmc: sdhci-iproc: " Binbin Zhou
` (19 subsequent siblings)
32 siblings, 2 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:06 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, Binbin Zhou, Angelo Dureghello
Since the devm_mmc_alloc_host() helper is already in
use, sdhci_pltfm_free() is no longer needed.
Cc: 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] 45+ messages in thread
* [PATCH 14/34] mmc: sdhci-iproc: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (12 preceding siblings ...)
2025-05-26 6:06 ` [PATCH 13/34] mmc: sdhci-esdhc-mcf: " Binbin Zhou
@ 2025-05-26 6:06 ` Binbin Zhou
2025-05-26 6:06 ` [PATCH 15/34] mmc: sdhci-msm: " Binbin Zhou
` (18 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:06 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 15/34] mmc: sdhci-msm: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (13 preceding siblings ...)
2025-05-26 6:06 ` [PATCH 14/34] mmc: sdhci-iproc: " Binbin Zhou
@ 2025-05-26 6:06 ` Binbin Zhou
2025-05-26 6:06 ` [PATCH 16/34] mmc: sdhci-npcm: " Binbin Zhou
` (17 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:06 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 16/34] mmc: sdhci-npcm: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (14 preceding siblings ...)
2025-05-26 6:06 ` [PATCH 15/34] mmc: sdhci-msm: " Binbin Zhou
@ 2025-05-26 6:06 ` Binbin Zhou
2025-05-26 6:06 ` [PATCH 17/34] mmc: sdhci-of-arasan: " Binbin Zhou
` (16 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:06 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 17/34] mmc: sdhci-of-arasan: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (15 preceding siblings ...)
2025-05-26 6:06 ` [PATCH 16/34] mmc: sdhci-npcm: " Binbin Zhou
@ 2025-05-26 6:06 ` Binbin Zhou
2025-05-26 7:34 ` Michal Simek
2025-05-26 6:06 ` [PATCH 18/34] mmc: sdhci-of-aspeed: " Binbin Zhou
` (15 subsequent siblings)
32 siblings, 1 reply; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:06 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 18/34] mmc: sdhci-of-aspeed: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (16 preceding siblings ...)
2025-05-26 6:06 ` [PATCH 17/34] mmc: sdhci-of-arasan: " Binbin Zhou
@ 2025-05-26 6:06 ` Binbin Zhou
2025-05-28 0:43 ` Andrew Jeffery
2025-05-26 6:06 ` [PATCH 19/34] mmc: sdhci-of-at91: " Binbin Zhou
` (14 subsequent siblings)
32 siblings, 1 reply; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:06 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, Binbin Zhou, Andrew Jeffery, 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] 45+ messages in thread
* [PATCH 19/34] mmc: sdhci-of-at91: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (17 preceding siblings ...)
2025-05-26 6:06 ` [PATCH 18/34] mmc: sdhci-of-aspeed: " Binbin Zhou
@ 2025-05-26 6:06 ` Binbin Zhou
2025-05-26 6:06 ` [PATCH 20/34] mmc: sdhci-of-dwcmshc: " Binbin Zhou
` (13 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:06 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 20/34] mmc: sdhci-of-dwcmshc: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (18 preceding siblings ...)
2025-05-26 6:06 ` [PATCH 19/34] mmc: sdhci-of-at91: " Binbin Zhou
@ 2025-05-26 6:06 ` Binbin Zhou
2025-05-26 6:06 ` [PATCH 21/34] mmc: sdhci-of-esdhc: " Binbin Zhou
` (12 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:06 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 21/34] mmc: sdhci-of-esdhc: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (19 preceding siblings ...)
2025-05-26 6:06 ` [PATCH 20/34] mmc: sdhci-of-dwcmshc: " Binbin Zhou
@ 2025-05-26 6:06 ` Binbin Zhou
2025-05-26 6:06 ` [PATCH 22/34] mmc: sdhci-of-k1: " Binbin Zhou
` (11 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:06 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 22/34] mmc: sdhci-of-k1: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (20 preceding siblings ...)
2025-05-26 6:06 ` [PATCH 21/34] mmc: sdhci-of-esdhc: " Binbin Zhou
@ 2025-05-26 6:06 ` Binbin Zhou
2025-05-26 10:04 ` Yixun Lan
2025-05-26 6:06 ` [PATCH 23/34] mmc: sdhci-of-ma35d1: " Binbin Zhou
` (10 subsequent siblings)
32 siblings, 1 reply; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:06 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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 | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/drivers/mmc/host/sdhci-of-k1.c b/drivers/mmc/host/sdhci-of-k1.c
index 6880d3e9ab62..40c1929f2de2 100644
--- a/drivers/mmc/host/sdhci-of-k1.c
+++ b/drivers/mmc/host/sdhci-of-k1.c
@@ -262,7 +262,7 @@ static int spacemit_sdhci_probe(struct platform_device *pdev)
ret = mmc_of_parse(host->mmc);
if (ret)
- goto err_pltfm;
+ return ret;
sdhci_get_of_property(pdev);
@@ -276,18 +276,11 @@ static int spacemit_sdhci_probe(struct platform_device *pdev)
host->mmc->caps |= MMC_CAP_NEED_RSP_BUSY;
- if (spacemit_sdhci_get_clocks(dev, pltfm_host))
- goto err_pltfm;
-
- ret = sdhci_add_host(host);
+ ret = spacemit_sdhci_get_clocks(dev, pltfm_host);
if (ret)
- goto err_pltfm;
-
- return 0;
+ return ret;
-err_pltfm:
- sdhci_pltfm_free(pdev);
- return ret;
+ return sdhci_add_host(host);
}
static struct platform_driver spacemit_sdhci_driver = {
--
2.47.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH 23/34] mmc: sdhci-of-ma35d1: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (21 preceding siblings ...)
2025-05-26 6:06 ` [PATCH 22/34] mmc: sdhci-of-k1: " Binbin Zhou
@ 2025-05-26 6:06 ` Binbin Zhou
2025-05-26 6:06 ` [PATCH 24/34] mmc: sdhci-of-sparx5: " Binbin Zhou
` (9 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:06 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 24/34] mmc: sdhci-of-sparx5: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (22 preceding siblings ...)
2025-05-26 6:06 ` [PATCH 23/34] mmc: sdhci-of-ma35d1: " Binbin Zhou
@ 2025-05-26 6:06 ` Binbin Zhou
2025-05-26 6:06 ` [PATCH 25/34] mmc: sdhci-omap: " Binbin Zhou
` (8 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:06 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 25/34] mmc: sdhci-omap: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (23 preceding siblings ...)
2025-05-26 6:06 ` [PATCH 24/34] mmc: sdhci-of-sparx5: " Binbin Zhou
@ 2025-05-26 6:06 ` Binbin Zhou
2025-05-26 6:06 ` [PATCH 26/34] mmc: sdhci-pic32: " Binbin Zhou
` (7 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:06 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 26/34] mmc: sdhci-pic32: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (24 preceding siblings ...)
2025-05-26 6:06 ` [PATCH 25/34] mmc: sdhci-omap: " Binbin Zhou
@ 2025-05-26 6:06 ` Binbin Zhou
2025-05-26 6:07 ` [PATCH 27/34] mmc: sdhci-pxav2: " Binbin Zhou
` (6 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:06 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 27/34] mmc: sdhci-pxav2: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (25 preceding siblings ...)
2025-05-26 6:06 ` [PATCH 26/34] mmc: sdhci-pic32: " Binbin Zhou
@ 2025-05-26 6:07 ` Binbin Zhou
2025-05-26 6:07 ` [PATCH 28/34] mmc: sdhci-pxav3: " Binbin Zhou
` (5 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:07 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 28/34] mmc: sdhci-pxav3: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (26 preceding siblings ...)
2025-05-26 6:07 ` [PATCH 27/34] mmc: sdhci-pxav2: " Binbin Zhou
@ 2025-05-26 6:07 ` Binbin Zhou
2025-05-26 6:07 ` [PATCH 29/34] mmc: sdhci-sprd: " Binbin Zhou
` (4 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:07 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 29/34] mmc: sdhci-sprd: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (27 preceding siblings ...)
2025-05-26 6:07 ` [PATCH 28/34] mmc: sdhci-pxav3: " Binbin Zhou
@ 2025-05-26 6:07 ` Binbin Zhou
2025-05-28 3:31 ` Chunyan Zhang
2025-05-26 6:07 ` [PATCH 30/34] mmc: sdhci-st: " Binbin Zhou
` (3 subsequent siblings)
32 siblings, 1 reply; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:07 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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>
Cc: 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] 45+ messages in thread
* [PATCH 30/34] mmc: sdhci-st: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (28 preceding siblings ...)
2025-05-26 6:07 ` [PATCH 29/34] mmc: sdhci-sprd: " Binbin Zhou
@ 2025-05-26 6:07 ` Binbin Zhou
2025-05-26 6:07 ` [PATCH 31/34] mmc: sdhci-tegra: " Binbin Zhou
` (2 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:07 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 31/34] mmc: sdhci-tegra: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (29 preceding siblings ...)
2025-05-26 6:07 ` [PATCH 30/34] mmc: sdhci-st: " Binbin Zhou
@ 2025-05-26 6:07 ` Binbin Zhou
2025-05-26 6:07 ` [PATCH 32/34] mmc: sdhci-xenon: " Binbin Zhou
2025-05-26 6:07 ` [PATCH 33/34] mmc: sdhci_am654: " Binbin Zhou
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:07 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 32/34] mmc: sdhci-xenon: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (30 preceding siblings ...)
2025-05-26 6:07 ` [PATCH 31/34] mmc: sdhci-tegra: " Binbin Zhou
@ 2025-05-26 6:07 ` Binbin Zhou
2025-05-26 6:07 ` [PATCH 33/34] mmc: sdhci_am654: " Binbin Zhou
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:07 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* [PATCH 33/34] mmc: sdhci_am654: Drop the use of sdhci_pltfm_free()
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
` (31 preceding siblings ...)
2025-05-26 6:07 ` [PATCH 32/34] mmc: sdhci-xenon: " Binbin Zhou
@ 2025-05-26 6:07 ` Binbin Zhou
32 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:07 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, 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] 45+ messages in thread
* Re: [PATCH 01/34] mmc: sdhci: Use devm_mmc_alloc_host() helper
2025-05-26 6:05 ` [PATCH 01/34] mmc: sdhci: Use devm_mmc_alloc_host() helper Binbin Zhou
@ 2025-05-26 6:27 ` Adrian Hunter
2025-05-26 6:46 ` Binbin Zhou
0 siblings, 1 reply; 45+ messages in thread
From: Adrian Hunter @ 2025-05-26 6:27 UTC (permalink / raw)
To: Binbin Zhou, Binbin Zhou, Huacai Chen, Ulf Hansson; +Cc: Huacai Chen, linux-mmc
On 26/05/2025 09:05, Binbin Zhou wrote:
> Use new function devm_mmc_alloc_host() to simplify the code.
>
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> ---
> drivers/mmc/host/sdhci.c | 9 +--------
> drivers/mmc/host/sdhci.h | 1 -
> 2 files changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 32fa0b2bb912..c40caa3f003f 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);
>
> @@ -5000,13 +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)
> -{
> - mmc_free_host(host->mmc);
> -}
> -
> -EXPORT_SYMBOL_GPL(sdhci_free_host);
Doesn't that break the compile for everything still using sdhci_free_host()?
You probably need to make it like this:
void sdhci_free_host(struct sdhci_host *host)
{
}
EXPORT_SYMBOL_GPL(sdhci_free_host);
and then remove sdhci_free_host() at the end when there are no callers
left.
> -
> /*****************************************************************************\
> * *
> * 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)
> {
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 01/34] mmc: sdhci: Use devm_mmc_alloc_host() helper
2025-05-26 6:27 ` Adrian Hunter
@ 2025-05-26 6:46 ` Binbin Zhou
0 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 6:46 UTC (permalink / raw)
To: Adrian Hunter
Cc: Binbin Zhou, Huacai Chen, Ulf Hansson, Huacai Chen, linux-mmc
Hi Adrian:
Thanks for your reply.
On Mon, May 26, 2025 at 2:27 PM Adrian Hunter <adrian.hunter@intel.com> wrote:
>
> On 26/05/2025 09:05, Binbin Zhou wrote:
> > Use new function devm_mmc_alloc_host() to simplify the code.
> >
> > Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> > ---
> > drivers/mmc/host/sdhci.c | 9 +--------
> > drivers/mmc/host/sdhci.h | 1 -
> > 2 files changed, 1 insertion(+), 9 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> > index 32fa0b2bb912..c40caa3f003f 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);
> >
> > @@ -5000,13 +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)
> > -{
> > - mmc_free_host(host->mmc);
> > -}
> > -
> > -EXPORT_SYMBOL_GPL(sdhci_free_host);
>
> Doesn't that break the compile for everything still using sdhci_free_host()?
>
> You probably need to make it like this:
>
> void sdhci_free_host(struct sdhci_host *host)
> {
> }
> EXPORT_SYMBOL_GPL(sdhci_free_host);
>
> and then remove sdhci_free_host() at the end when there are no callers
> left.
>
Yes, I didn't think it through and I will change it in the next
version the way you said.
Patch-07 has the same problem, I'll fix it all together.
>
> > -
> > /*****************************************************************************\
> > * *
> > * 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)
> > {
>
--
Thanks.
Binbin
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 17/34] mmc: sdhci-of-arasan: Drop the use of sdhci_pltfm_free()
2025-05-26 6:06 ` [PATCH 17/34] mmc: sdhci-of-arasan: " Binbin Zhou
@ 2025-05-26 7:34 ` Michal Simek
2025-05-26 7:48 ` Binbin Zhou
0 siblings, 1 reply; 45+ messages in thread
From: Michal Simek @ 2025-05-26 7:34 UTC (permalink / raw)
To: Binbin Zhou, Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc
On 5/26/25 08:06, Binbin Zhou wrote:
> 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;
> }
>
I don't have problem with this change but your series is just wrong. Because
"mmc: sdhci-pltfm: Drop the use of sdhci_pltfm_free()"
is just removing this function before you convert all drivers. It means you just
break bisectability of tree which is clear NACK.
Thanks,
Michal
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 17/34] mmc: sdhci-of-arasan: Drop the use of sdhci_pltfm_free()
2025-05-26 7:34 ` Michal Simek
@ 2025-05-26 7:48 ` Binbin Zhou
0 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-05-26 7:48 UTC (permalink / raw)
To: Michal Simek
Cc: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter, Huacai Chen,
linux-mmc
Hi Michal:
Thanks for your reply.
On Mon, May 26, 2025 at 3:34 PM Michal Simek <michal.simek@amd.com> wrote:
>
>
>
> On 5/26/25 08:06, Binbin Zhou wrote:
> > 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;
> > }
> >
>
> I don't have problem with this change but your series is just wrong. Because
> "mmc: sdhci-pltfm: Drop the use of sdhci_pltfm_free()"
> is just removing this function before you convert all drivers. It means you just
> break bisectability of tree which is clear NACK.
>
Yes, that's my fault, I didn't think it through.
Adrian just pointed this out, and I'll rework this section to empty
sdhci_pltfm_free() first, and then remove sdhci_pltfm_free()
completely at the end of the patchset.
> Thanks,
> Michal
>
--
Thanks.
Binbin
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 22/34] mmc: sdhci-of-k1: Drop the use of sdhci_pltfm_free()
2025-05-26 6:06 ` [PATCH 22/34] mmc: sdhci-of-k1: " Binbin Zhou
@ 2025-05-26 10:04 ` Yixun Lan
0 siblings, 0 replies; 45+ messages in thread
From: Yixun Lan @ 2025-05-26 10:04 UTC (permalink / raw)
To: Binbin Zhou
Cc: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter, Huacai Chen,
linux-mmc, linux-riscv, spacemit
hi Binbin,
On 14:06 Mon 26 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>
> ---
> drivers/mmc/host/sdhci-of-k1.c | 15 ++++-----------
> 1 file changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-k1.c b/drivers/mmc/host/sdhci-of-k1.c
> index 6880d3e9ab62..40c1929f2de2 100644
> --- a/drivers/mmc/host/sdhci-of-k1.c
> +++ b/drivers/mmc/host/sdhci-of-k1.c
> @@ -262,7 +262,7 @@ static int spacemit_sdhci_probe(struct platform_device *pdev)
>
> ret = mmc_of_parse(host->mmc);
> if (ret)
> - goto err_pltfm;
> + return ret;
>
> sdhci_get_of_property(pdev);
>
> @@ -276,18 +276,11 @@ static int spacemit_sdhci_probe(struct platform_device *pdev)
>
> host->mmc->caps |= MMC_CAP_NEED_RSP_BUSY;
>
> - if (spacemit_sdhci_get_clocks(dev, pltfm_host))
> - goto err_pltfm;
> -
> - ret = sdhci_add_host(host);
> + ret = spacemit_sdhci_get_clocks(dev, pltfm_host);
> if (ret)
> - goto err_pltfm;
> -
> - return 0;
> + return ret;
>
> -err_pltfm:
> - sdhci_pltfm_free(pdev);
> - return ret;
> + return sdhci_add_host(host);
> }
>
although this patch looks good, but can you preserve the goto scheme?
we might add other error handlings as implement SD/SDIO in the future
(it also keeps the change minimal and easy to review)
--
Yixun Lan (dlan)
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 18/34] mmc: sdhci-of-aspeed: Drop the use of sdhci_pltfm_free()
2025-05-26 6:06 ` [PATCH 18/34] mmc: sdhci-of-aspeed: " Binbin Zhou
@ 2025-05-28 0:43 ` Andrew Jeffery
2025-05-28 4:42 ` Binbin Zhou
0 siblings, 1 reply; 45+ messages in thread
From: Andrew Jeffery @ 2025-05-28 0:43 UTC (permalink / raw)
To: Binbin Zhou, Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter
Cc: Huacai Chen, linux-mmc, Joel Stanley, linux-aspeed, openbmc
On Mon, 2025-05-26 at 14:06 +0800, Binbin Zhou wrote:
> Since the devm_mmc_alloc_host() helper is already in
> use,
This doesn't appear to be true? aspeed_sdhci_probe() calls
sdhci_pltfm_init(), and following that through eventually we call
mmc_alloc_host() (the non-devm_ variant).
That said, there are some error paths in aspeed_sdhci_probe() where we
leak the object. Improving the code would be helpful, but my
understanding is this patch isn't right.
Andrew
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 29/34] mmc: sdhci-sprd: Drop the use of sdhci_pltfm_free()
2025-05-26 6:07 ` [PATCH 29/34] mmc: sdhci-sprd: " Binbin Zhou
@ 2025-05-28 3:31 ` Chunyan Zhang
0 siblings, 0 replies; 45+ messages in thread
From: Chunyan Zhang @ 2025-05-28 3:31 UTC (permalink / raw)
To: Binbin Zhou
Cc: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter, Huacai Chen,
linux-mmc, Orson Zhai, Baolin Wang
On Mon, 26 May 2025 at 14:07, Binbin Zhou <zhoubinbin@loongson.cn> wrote:
>
> 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>
> Cc: Chunyan Zhang <zhang.lyra@gmail.com>
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Reviewed-by: Chunyan Zhang <zhang.lyra@gmail.com>
Thanks,
Chunyan
> ---
> 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 [flat|nested] 45+ messages in thread
* Re: [PATCH 18/34] mmc: sdhci-of-aspeed: Drop the use of sdhci_pltfm_free()
2025-05-28 0:43 ` Andrew Jeffery
@ 2025-05-28 4:42 ` Binbin Zhou
2025-05-29 0:46 ` Andrew Jeffery
0 siblings, 1 reply; 45+ messages in thread
From: Binbin Zhou @ 2025-05-28 4:42 UTC (permalink / raw)
To: Andrew Jeffery
Cc: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter, Huacai Chen,
linux-mmc, Joel Stanley, linux-aspeed, openbmc
Hi Andrew:
Thanks for your reply.
On Wed, May 28, 2025 at 8:44 AM Andrew Jeffery
<andrew@codeconstruct.com.au> wrote:
>
> On Mon, 2025-05-26 at 14:06 +0800, Binbin Zhou wrote:
> > Since the devm_mmc_alloc_host() helper is already in
> > use,
>
> This doesn't appear to be true? aspeed_sdhci_probe() calls
> sdhci_pltfm_init(), and following that through eventually we call
> mmc_alloc_host() (the non-devm_ variant).
>
> That said, there are some error paths in aspeed_sdhci_probe() where we
> leak the object. Improving the code would be helpful, but my
> understanding is this patch isn't right.
Sorry, I have a different thought.
In the original code, there does seem to be a leakage of objects, for example:
pltfm_host->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(pltfm_host->clk))
return PTR_ERR(pltfm_host->clk);
With this error path, we should goto err_pltfm_free;
Now, I have replaced mmc_alloc_host() with devm_mmc_alloc_host() in
Patch-1[1], so I don't think there will be any error path leakage of
objects.
[1]: https://lore.kernel.org/all/6fd5afb003982bb5edbf95f76b605686223730e0.1747792905.git.zhoubinbin@loongson.cn/
>
> Andrew
--
Thanks.
Binbin
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH 13/34] mmc: sdhci-esdhc-mcf: Drop the use of sdhci_pltfm_free()
2025-05-26 6:06 ` [PATCH 13/34] mmc: sdhci-esdhc-mcf: " Binbin Zhou
@ 2025-05-28 8:00 ` Angelo Dureghello
2025-05-28 8:05 ` Angelo Dureghello
1 sibling, 0 replies; 45+ messages in thread
From: Angelo Dureghello @ 2025-05-28 8:00 UTC (permalink / raw)
To: Binbin Zhou
Cc: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter, Huacai Chen,
linux-mmc
Hi Binbin,
not sure to understand, where do you see devm_mmc_alloc_host() ("in use")
called for this sd controller ?
thanks,
Regards,
angelo
On 26.05.2025 14:06, Binbin Zhou wrote:
> Since the devm_mmc_alloc_host() helper is already in
> use, sdhci_pltfm_free() is no longer needed.
>
> Cc: 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 [flat|nested] 45+ messages in thread
* Re: [PATCH 13/34] mmc: sdhci-esdhc-mcf: Drop the use of sdhci_pltfm_free()
2025-05-26 6:06 ` [PATCH 13/34] mmc: sdhci-esdhc-mcf: " Binbin Zhou
2025-05-28 8:00 ` Angelo Dureghello
@ 2025-05-28 8:05 ` Angelo Dureghello
1 sibling, 0 replies; 45+ messages in thread
From: Angelo Dureghello @ 2025-05-28 8:05 UTC (permalink / raw)
To: Binbin Zhou
Cc: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter, Huacai Chen,
linux-mmc
Hi Binbin,
sorry, seen now it was invoked in 1/34.
Acked-by: Angelo Dureghello <adureghello@baylibre.com>
On 26.05.2025 14:06, Binbin Zhou wrote:
> Since the devm_mmc_alloc_host() helper is already in
> use, sdhci_pltfm_free() is no longer needed.
>
> Cc: 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 [flat|nested] 45+ messages in thread
* Re: [PATCH 18/34] mmc: sdhci-of-aspeed: Drop the use of sdhci_pltfm_free()
2025-05-28 4:42 ` Binbin Zhou
@ 2025-05-29 0:46 ` Andrew Jeffery
0 siblings, 0 replies; 45+ messages in thread
From: Andrew Jeffery @ 2025-05-29 0:46 UTC (permalink / raw)
To: Binbin Zhou
Cc: Binbin Zhou, Huacai Chen, Ulf Hansson, Adrian Hunter, Huacai Chen,
linux-mmc, Joel Stanley, linux-aspeed, openbmc
On Wed, 2025-05-28 at 12:42 +0800, Binbin Zhou wrote:
> Hi Andrew:
>
> Thanks for your reply.
>
> On Wed, May 28, 2025 at 8:44 AM Andrew Jeffery
> <andrew@codeconstruct.com.au> wrote:
> >
> > On Mon, 2025-05-26 at 14:06 +0800, Binbin Zhou wrote:
> > > Since the devm_mmc_alloc_host() helper is already in
> > > use,
> >
> > This doesn't appear to be true? aspeed_sdhci_probe() calls
> > sdhci_pltfm_init(), and following that through eventually we call
> > mmc_alloc_host() (the non-devm_ variant).
> >
> > That said, there are some error paths in aspeed_sdhci_probe() where we
> > leak the object. Improving the code would be helpful, but my
> > understanding is this patch isn't right.
>
> Sorry, I have a different thought.
> In the original code, there does seem to be a leakage of objects, for example:
>
> pltfm_host->clk = devm_clk_get(&pdev->dev, NULL);
> if (IS_ERR(pltfm_host->clk))
> return PTR_ERR(pltfm_host->clk);
>
> With this error path, we should goto err_pltfm_free;
>
> Now, I have replaced mmc_alloc_host() with devm_mmc_alloc_host() in
> Patch-1[1], so I don't think there will be any error path leakage of
> objects.
>
> [1]: https://lore.kernel.org/all/6fd5afb003982bb5edbf95f76b605686223730e0.1747792905.git.zhoubinbin@loongson.cn/
Okay, I didn't track down the rest of the series on lore. I don't
personally mind if you send me the whole series, that would certainly
have helped with the context in this case.
Andrew
^ permalink raw reply [flat|nested] 45+ messages in thread
end of thread, other threads:[~2025-05-29 0:46 UTC | newest]
Thread overview: 45+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-26 6:05 [PATCH 00/34] mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage Binbin Zhou
2025-05-26 6:05 ` [PATCH 01/34] mmc: sdhci: Use devm_mmc_alloc_host() helper Binbin Zhou
2025-05-26 6:27 ` Adrian Hunter
2025-05-26 6:46 ` Binbin Zhou
2025-05-26 6:05 ` [PATCH 02/34] mmc: sdhci-acpi: Drop the use of sdhci_free_host() Binbin Zhou
2025-05-26 6:05 ` [PATCH 03/34] mmc: sdhci-milbeaut: " Binbin Zhou
2025-05-26 6:05 ` [PATCH 04/34] mmc: sdhci-pci: " Binbin Zhou
2025-05-26 6:05 ` [PATCH 05/34] mmc: sdhci-s3c: " Binbin Zhou
2025-05-26 6:05 ` [PATCH 06/34] mmc: sdhci-spear: " Binbin Zhou
2025-05-26 6:05 ` [PATCH 07/34] mmc: sdhci-pltfm: Drop the use of sdhci_pltfm_free() Binbin Zhou
2025-05-26 6:05 ` [PATCH 08/34] mmc: sdhci-bcm-kona: " Binbin Zhou
2025-05-26 6:05 ` [PATCH 09/34] mmc: sdhci-brcmstb: " Binbin Zhou
2025-05-26 6:06 ` [PATCH 10/34] mmc: sdhci-cadence: " Binbin Zhou
2025-05-26 6:06 ` [PATCH 11/34] mmc: sdhci-dove: " Binbin Zhou
2025-05-26 6:06 ` [PATCH 12/34] mmc: sdhci-esdhc-imx: " Binbin Zhou
2025-05-26 6:06 ` [PATCH 13/34] mmc: sdhci-esdhc-mcf: " Binbin Zhou
2025-05-28 8:00 ` Angelo Dureghello
2025-05-28 8:05 ` Angelo Dureghello
2025-05-26 6:06 ` [PATCH 14/34] mmc: sdhci-iproc: " Binbin Zhou
2025-05-26 6:06 ` [PATCH 15/34] mmc: sdhci-msm: " Binbin Zhou
2025-05-26 6:06 ` [PATCH 16/34] mmc: sdhci-npcm: " Binbin Zhou
2025-05-26 6:06 ` [PATCH 17/34] mmc: sdhci-of-arasan: " Binbin Zhou
2025-05-26 7:34 ` Michal Simek
2025-05-26 7:48 ` Binbin Zhou
2025-05-26 6:06 ` [PATCH 18/34] mmc: sdhci-of-aspeed: " Binbin Zhou
2025-05-28 0:43 ` Andrew Jeffery
2025-05-28 4:42 ` Binbin Zhou
2025-05-29 0:46 ` Andrew Jeffery
2025-05-26 6:06 ` [PATCH 19/34] mmc: sdhci-of-at91: " Binbin Zhou
2025-05-26 6:06 ` [PATCH 20/34] mmc: sdhci-of-dwcmshc: " Binbin Zhou
2025-05-26 6:06 ` [PATCH 21/34] mmc: sdhci-of-esdhc: " Binbin Zhou
2025-05-26 6:06 ` [PATCH 22/34] mmc: sdhci-of-k1: " Binbin Zhou
2025-05-26 10:04 ` Yixun Lan
2025-05-26 6:06 ` [PATCH 23/34] mmc: sdhci-of-ma35d1: " Binbin Zhou
2025-05-26 6:06 ` [PATCH 24/34] mmc: sdhci-of-sparx5: " Binbin Zhou
2025-05-26 6:06 ` [PATCH 25/34] mmc: sdhci-omap: " Binbin Zhou
2025-05-26 6:06 ` [PATCH 26/34] mmc: sdhci-pic32: " Binbin Zhou
2025-05-26 6:07 ` [PATCH 27/34] mmc: sdhci-pxav2: " Binbin Zhou
2025-05-26 6:07 ` [PATCH 28/34] mmc: sdhci-pxav3: " Binbin Zhou
2025-05-26 6:07 ` [PATCH 29/34] mmc: sdhci-sprd: " Binbin Zhou
2025-05-28 3:31 ` Chunyan Zhang
2025-05-26 6:07 ` [PATCH 30/34] mmc: sdhci-st: " Binbin Zhou
2025-05-26 6:07 ` [PATCH 31/34] mmc: sdhci-tegra: " Binbin Zhou
2025-05-26 6:07 ` [PATCH 32/34] mmc: sdhci-xenon: " Binbin Zhou
2025-05-26 6:07 ` [PATCH 33/34] mmc: sdhci_am654: " Binbin Zhou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox