[PATCH 1/3] i2c: pca-platform: Handle errors from optional IRQ lookup
[email protected] Thu, 13 Aug 2026 15:52:11 +0700
| Newsgroups | org.kernel.vger.linux-i2c,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
From: bui duc phuc <[email protected]> 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 <[email protected]> --- 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