[PATCH v2 2/3] mmc: davinci: Handle errors from optional IRQ lookup

phucduc.bui at gmail.com phucduc.bui at gmail.com
Wed Aug 12 22:34:03 PDT 2026


From: bui duc phuc <phucduc.bui at 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.

Signed-off-by: bui duc phuc <phucduc.bui at gmail.com>
---

Changes in v2:
 - Use parse_fail for proper cleanup on IRQ lookup errors.
 - Keep the value returned by platform_get_irq_optional() 
   in host->sdio_irq, since it is already checked 
   before calling devm_request_irq().

 drivers/mmc/host/davinci_mmc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index cdb9fa94b56d..773577a10512 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1249,6 +1249,10 @@ 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);
+	if (host->sdio_irq < 0 && host->sdio_irq != -ENXIO) {
+		ret = host->sdio_irq;
+		goto parse_fail;
+	}
 
 	if (host->use_dma) {
 		ret = davinci_acquire_dma_channels(host);
-- 
2.43.0




More information about the linux-arm-kernel mailing list