The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 1/2] rtc: m48t59: Propagate errors from optional IRQ lookup
@ 2026-08-10  5:15 phucduc.bui
  2026-08-10  5:15 ` [PATCH 2/2] rtc: cmos: " phucduc.bui
  0 siblings, 1 reply; 2+ messages in thread
From: phucduc.bui @ 2026-08-10  5:15 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: linux-rtc, linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@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, while other errors should be propagated.

Propagate all error codes returned by platform_get_irq_optional() other
than -ENXIO, so that failures are properly reported to the caller.
Preserve NO_IRQ for the case where no optional IRQ is available.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/rtc/rtc-m48t59.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c
index 4e608bc8bbd3..1150f3f6b008 100644
--- a/drivers/rtc/rtc-m48t59.c
+++ b/drivers/rtc/rtc-m48t59.c
@@ -404,15 +404,17 @@ static int m48t59_rtc_probe(struct platform_device *pdev)
 	 * the mode without IRQ.
 	 */
 	m48t59->irq = platform_get_irq_optional(pdev, 0);
-	if (m48t59->irq <= 0)
-		m48t59->irq = NO_IRQ;
+	if (m48t59->irq < 0 && m48t59->irq != -ENXIO)
+		return m48t59->irq;
 
-	if (m48t59->irq != NO_IRQ) {
+	if (m48t59->irq > 0) {
 		ret = devm_request_irq(&pdev->dev, m48t59->irq,
 				m48t59_rtc_interrupt, IRQF_SHARED,
 				"rtc-m48t59", &pdev->dev);
 		if (ret)
 			return ret;
+	} else {
+		m48t59->irq = NO_IRQ;
 	}
 
 	m48t59->rtc = devm_rtc_allocate_device(&pdev->dev);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] rtc: cmos: Propagate errors from optional IRQ lookup
  2026-08-10  5:15 [PATCH 1/2] rtc: m48t59: Propagate errors from optional IRQ lookup phucduc.bui
@ 2026-08-10  5:15 ` phucduc.bui
  0 siblings, 0 replies; 2+ messages in thread
From: phucduc.bui @ 2026-08-10  5:15 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: linux-rtc, linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@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, 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 <phucduc.bui@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-10  5:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-10  5:15 [PATCH 1/2] rtc: m48t59: Propagate errors from optional IRQ lookup phucduc.bui
2026-08-10  5:15 ` [PATCH 2/2] rtc: cmos: " phucduc.bui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox