Skip to contentSkip to conversation

mmc: davinci: fix mmc_add_host order in probe

PATCH In review Osama Abdelkader 2 participants 2 messages May 10 – May 29 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: davinci: fix mmc_add_host order in probe

mmc_add_host() makes the host visible to the MMC core. Register the interrupt handlers and advertise MMC_CAP_SDIO_IRQ before that, so the core cannot start using the host before IRQ handling is set up.

---
 drivers/mmc/host/davinci_mmc.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/mmc/host/davinci_mmc.c +5 -7
index 42b0118a45a8..a598febe7332 100644
@@ -1294,14 +1294,10 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)
 		goto cpu_freq_fail;
 	}
 
-	ret = mmc_add_host(mmc);
-	if (ret < 0)
-		goto mmc_add_host_fail;
-
 	ret = devm_request_irq(&pdev->dev, irq, mmc_davinci_irq, 0,
 			       mmc_hostname(mmc), host);
 	if (ret)
-		goto request_irq_fail;
+		goto mmc_add_host_fail;
 
 	if (host->sdio_irq >= 0) {
 		ret = devm_request_irq(&pdev->dev, host->sdio_irq,
@@ -1311,6 +1307,10 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)
 			mmc->caps |= MMC_CAP_SDIO_IRQ;
 	}
 
+	ret = mmc_add_host(mmc);
+	if (ret < 0)
+		goto mmc_add_host_fail;
+
 	rename_region(mem, mmc_hostname(mmc));
 
 	if (mmc->caps & MMC_CAP_8_BIT_DATA)
@@ -1324,8 +1324,6 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)
 
 	return 0;
 
-request_irq_fail:
-	mmc_remove_host(mmc);
 mmc_add_host_fail:
 	mmc_davinci_cpufreq_deregister(host);
 cpu_freq_fail:
Signature · 1 line
2.43.0
#1 lore raw
Quoted 6 lines · Osama Abdelkader

mmc_add_host() makes the host visible to the MMC core. Register the interrupt handlers and advertise MMC_CAP_SDIO_IRQ before that, so the core cannot start using the host before IRQ handling is set up.

Applied for next, thanks!

Kind regards
Uffe

Quoted 46 lines
---
 drivers/mmc/host/davinci_mmc.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/mmc/host/davinci_mmc.c +5 -8
index 42b0118a45a8..a598febe7332 100644
@@ -1294,14 +1294,10 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)
                goto cpu_freq_fail;
        }
 
-       ret = mmc_add_host(mmc);
-       if (ret < 0)
-               goto mmc_add_host_fail;
-
        ret = devm_request_irq(&pdev->dev, irq, mmc_davinci_irq, 0,
                               mmc_hostname(mmc), host);
        if (ret)
-               goto request_irq_fail;
+               goto mmc_add_host_fail;
 
        if (host->sdio_irq >= 0) {
                ret = devm_request_irq(&pdev->dev, host->sdio_irq,
@@ -1311,6 +1307,10 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)
                        mmc->caps |= MMC_CAP_SDIO_IRQ;
        }
 
+       ret = mmc_add_host(mmc);
+       if (ret < 0)
+               goto mmc_add_host_fail;
+
        rename_region(mem, mmc_hostname(mmc));
 
        if (mmc->caps & MMC_CAP_8_BIT_DATA)
@@ -1324,8 +1324,6 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)
 
        return 0;
 
-request_irq_fail:
-       mmc_remove_host(mmc);
 mmc_add_host_fail:
        mmc_davinci_cpufreq_deregister(host);
 cpu_freq_fail:
--

2.43.0