[PATCH 2/2] rtc: cmos: Propagate errors from optional IRQ lookup
| Newsgroups | org.kernel.vger.linux-rtc,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, while other errors should be propagated. Propagate all error codes returned by platform_get_irq_optional() other than -ENXIO, while preserving -1 for the case where no optional IRQ is available. Signed-off-by: bui duc phuc <[email protected]> --- drivers/rtc/rtc-cmos.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index fa04ece151b8..0a2c7383c8cd 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -1436,7 +1436,9 @@ static int __init cmos_platform_probe(struct platform_device *pdev) else resource = platform_get_resource(pdev, IORESOURCE_MEM, 0); irq = platform_get_irq_optional(pdev, 0); - if (irq < 0) { + if (irq < 0 && irq != -ENXIO) + return irq; + if (irq == -ENXIO) { irq = -1; #ifdef CONFIG_X86 /* -- 2.43.0