Skip to contentSkip to conversation

mmc: mxcmmc: fix error return code in mxcmci_probe()

PATCH Applied Gustavo A. R. Silva 2 participants 3 messages Jul 7, 2017 – Jul 17, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: mxcmmc: fix error return code in mxcmci_probe()

platform_get_irq() returns an error code, but the mxcmmc driver ignores it and always returns -EINVAL. This is not correct, and prevents -EPROBE_DEFER from being propagated properly.

Print error message and propagate the return value of platform_get_irq on failure.

---
 drivers/mmc/host/mxcmmc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/host/mxcmmc.c +4 -2
index fb3ca82..f3c2832 100644
@@ -1014,8 +1014,10 @@ static int mxcmci_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
-		return -EINVAL;
+	if (irq < 0) {
+		dev_err(&pdev->dev, "failed to get IRQ: %d\n", irq);
+		return irq;
+	}
 
 	mmc = mmc_alloc_host(sizeof(*host), &pdev->dev);
 	if (!mmc)
Signature · 1 line
2.5.0
Applied
#1 lore raw
Quoted 8 lines · Gustavo A. R. Silva

platform_get_irq() returns an error code, but the mxcmmc driver ignores it and always returns -EINVAL. This is not correct, and prevents -EPROBE_DEFER from being propagated properly.

Print error message and propagate the return value of platform_get_irq on failure.

Thanks, applied for next!

Kind regards
Uffe

Quoted 24 lines
---
 drivers/mmc/host/mxcmmc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/host/mxcmmc.c +4 -3
index fb3ca82..f3c2832 100644
@@ -1014,8 +1014,10 @@ static int mxcmci_probe(struct platform_device *pdev)
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        irq = platform_get_irq(pdev, 0);
-       if (irq < 0)
-               return -EINVAL;
+       if (irq < 0) {
+               dev_err(&pdev->dev, "failed to get IRQ: %d\n", irq);
+               return irq;
+       }
 
        mmc = mmc_alloc_host(sizeof(*host), &pdev->dev);
        if (!mmc)
--

2.5.0

#2 lore raw

Hi Ulf,

Quoted 5 lines · Ulf Hansson
Quoted 4 lines · Gustavo A. R. Silva

platform_get_irq() returns an error code, but the mxcmmc driver ignores it and always returns -EINVAL. This is not correct, and prevents -EPROBE_DEFER from being propagated properly.

Quoted 7 lines
Quoted 4 lines

Print error message and propagate the return value of platform_get_irq on failure.

Thanks, applied for next!

Thank you!

Quoted 27 lines

Kind regards
Uffe

Quoted 24 lines
---
 drivers/mmc/host/mxcmmc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/host/mxcmmc.c +4 -3
index fb3ca82..f3c2832 100644
@@ -1014,8 +1014,10 @@ static int mxcmci_probe(struct platform_device *pdev)
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        irq = platform_get_irq(pdev, 0);
-       if (irq < 0)
-               return -EINVAL;
+       if (irq < 0) {
+               dev_err(&pdev->dev, "failed to get IRQ: %d\n", irq);
+               return irq;
+       }
 
        mmc = mmc_alloc_host(sizeof(*host), &pdev->dev);
        if (!mmc)
--

2.5.0

Signature · 1 line
Gustavo A. R. Silva