* [PATCH 1/3] mmc: meson-gx: Handle errors from optional IRQ lookup
2026-08-12 11:20 [PATCH 0/3] mmc: Handle errors from optional IRQ lookup phucduc.bui
@ 2026-08-12 11:20 ` phucduc.bui
2026-08-12 11:20 ` [PATCH 2/3] mmc: davinci: " phucduc.bui
2026-08-12 11:20 ` [PATCH 3/3] mmc: davinci: Handle optional IRQ return value correctly phucduc.bui
2 siblings, 0 replies; 4+ messages in thread
From: phucduc.bui @ 2026-08-12 11:20 UTC (permalink / raw)
To: Ulf Hansson, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Jisheng Zhang, Stepan Ionichev,
Colin Ian King, Pedro Demarchi Gomes, Osama Abdelkader, linux-mmc,
linux-arm-kernel, linux-amlogic
Cc: linux-kernel, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
platform_get_irq_optional() returns a positive IRQ number on success or
a negative error code on failure. For an optional IRQ, -ENXIO indicates
that no optional IRQ is available. Other errors, such as -EPROBE_DEFER
and -EINVAL, should be propagated so that the caller can handle them
appropriately.
However, the driver currently stores the return value directly in
cd_irq and continues probing.
Propagate negative errors other than -ENXIO, and only assign the IRQ to
cd_irq when a valid IRQ number is returned.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
drivers/mmc/host/meson-gx-mmc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 694bb443d5f3..af94c8138fcf 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -1185,7 +1185,11 @@ static int meson_mmc_probe(struct platform_device *pdev)
if (host->irq < 0)
return host->irq;
- cd_irq = platform_get_irq_optional(pdev, 1);
+ ret = platform_get_irq_optional(pdev, 1);
+ if (ret < 0 && ret != -ENXIO)
+ return ret;
+ if (ret > 0)
+ cd_irq = ret;
mmc_gpio_set_cd_irq(mmc, cd_irq);
host->pinctrl = devm_pinctrl_get(&pdev->dev);
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] mmc: davinci: Handle errors from optional IRQ lookup
2026-08-12 11:20 [PATCH 0/3] mmc: Handle errors from optional IRQ lookup phucduc.bui
2026-08-12 11:20 ` [PATCH 1/3] mmc: meson-gx: " phucduc.bui
@ 2026-08-12 11:20 ` phucduc.bui
2026-08-12 11:20 ` [PATCH 3/3] mmc: davinci: Handle optional IRQ return value correctly phucduc.bui
2 siblings, 0 replies; 4+ messages in thread
From: phucduc.bui @ 2026-08-12 11:20 UTC (permalink / raw)
To: Ulf Hansson, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Jisheng Zhang, Stepan Ionichev,
Colin Ian King, Pedro Demarchi Gomes, Osama Abdelkader, linux-mmc,
linux-arm-kernel, linux-amlogic
Cc: linux-kernel, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
platform_get_irq_optional() returns a positive IRQ number on success or
a negative error code on failure. For an optional IRQ, -ENXIO indicates
that no optional IRQ is available. Other errors, such as -EPROBE_DEFER
and -EINVAL, should be propagated so that the caller can handle them
appropriately.
However, the driver currently stores the return value directly in
host->sdio_irq and continues probing.
Propagate negative errors other than -ENXIO, and only assign the IRQ to
host->sdio_irq when a valid IRQ number is returned.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
drivers/mmc/host/davinci_mmc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index cdb9fa94b56d..4765d2dee599 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1248,7 +1248,11 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)
host->use_dma = use_dma;
host->mmc_irq = irq;
- host->sdio_irq = platform_get_irq_optional(pdev, 1);
+ ret = platform_get_irq_optional(pdev, 1);
+ if (ret < 0 && ret != -ENXIO)
+ return ret;
+ if (ret > 0)
+ host->sdio_irq = ret;
if (host->use_dma) {
ret = davinci_acquire_dma_channels(host);
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 3/3] mmc: davinci: Handle optional IRQ return value correctly
2026-08-12 11:20 [PATCH 0/3] mmc: Handle errors from optional IRQ lookup phucduc.bui
2026-08-12 11:20 ` [PATCH 1/3] mmc: meson-gx: " phucduc.bui
2026-08-12 11:20 ` [PATCH 2/3] mmc: davinci: " phucduc.bui
@ 2026-08-12 11:20 ` phucduc.bui
2 siblings, 0 replies; 4+ messages in thread
From: phucduc.bui @ 2026-08-12 11:20 UTC (permalink / raw)
To: Ulf Hansson, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Jisheng Zhang, Stepan Ionichev,
Colin Ian King, Pedro Demarchi Gomes, Osama Abdelkader, linux-mmc,
linux-arm-kernel, linux-amlogic
Cc: linux-kernel, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
host->sdio_irq is assigned from platform_get_irq_optional(), which
returns a positive IRQ number on success or a negative error code on
failure. Therefore, 0 is not a possible return value from this API.
Check for a positive IRQ number before requesting the SDIO IRQ instead
of treating zero as a valid IRQ.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
drivers/mmc/host/davinci_mmc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 4765d2dee599..dddd152d2ec4 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1303,7 +1303,7 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)
if (ret)
goto mmc_add_host_fail;
- if (host->sdio_irq >= 0) {
+ if (host->sdio_irq > 0) {
ret = devm_request_irq(&pdev->dev, host->sdio_irq,
mmc_davinci_sdio_irq, 0,
mmc_hostname(mmc), host);
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread