[PATCH 2/3] i2c: brcmstb: Handle errors from optional IRQ lookup

[email protected]
Newsgroups gmane.linux.drivers.i2c,gmane.linux.ports.arm.kernel,gmane.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-brcmstb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c
index 5fa30e8926c5..91525a36e575 100644
--- a/drivers/i2c/busses/i2c-brcmstb.c
+++ b/drivers/i2c/busses/i2c-brcmstb.c
@@ -648,6 +648,8 @@ static int brcmstb_i2c_probe(struct platform_device *pdev)
 
 	/* Get the interrupt number */
 	dev->irq = platform_get_irq_optional(pdev, 0);
+	if (dev->irq < 0 && dev->irq != -ENXIO)
+		return dev->irq;
 
 	/* disable the bsc interrupt line */
 	brcmstb_i2c_enable_disable_irq(dev, INT_DISABLE);
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.