[PATCH 2/3] platform/x86: intel: punit_ipc: Propagate errors from optional IRQ lookup

[email protected]
Newsgroups org.kernel.vger.platform-driver-x86,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 and the driver can fall back to polling
mode. Other errors should be propagated so that the caller can handle
them appropriately.

Treat -ENXIO as the only case where the driver falls back to polling
mode, and propagate all other errors returned by
platform_get_irq_optional().

Signed-off-by: bui duc phuc <[email protected]>
---
 drivers/platform/x86/intel/punit_ipc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/platform/x86/intel/punit_ipc.c b/drivers/platform/x86/intel/punit_ipc.c
index 6d770b950dfb..590b145fd5ca 100644
--- a/drivers/platform/x86/intel/punit_ipc.c
+++ b/drivers/platform/x86/intel/punit_ipc.c
@@ -245,6 +245,8 @@ static int intel_punit_ipc_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq_optional(pdev, 0);
 	if (irq < 0) {
+		if (irq != -ENXIO)
+			return irq;
 		dev_warn(&pdev->dev, "Invalid IRQ, using polling mode\n");
 	} else {
 		ret = devm_request_irq(&pdev->dev, irq, intel_punit_ioc,
-- 
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.