[PATCH 1/3] i2c: pca-platform: Handle errors from optional IRQ lookup
phucduc.bui at gmail.com
phucduc.bui at gmail.com
Thu Aug 13 01:52:11 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.
Propagate negative errors other than -ENXIO.
Signed-off-by: bui duc phuc <phucduc.bui at gmail.com>
---
drivers/i2c/busses/i2c-pca-platform.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c
index c0f35ebbe37d..63c8ca1f1870 100644
--- a/drivers/i2c/busses/i2c-pca-platform.c
+++ b/drivers/i2c/busses/i2c-pca-platform.c
@@ -139,8 +139,11 @@ static int i2c_pca_pf_probe(struct platform_device *pdev)
irq = platform_get_irq_optional(pdev, 0);
/* If irq is 0, we do polling. */
- if (irq < 0)
+ if (irq < 0) {
+ if (irq != -ENXIO)
+ return irq;
irq = 0;
+ }
i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL);
if (!i2c)
--
2.43.0
More information about the linux-arm-kernel
mailing list