* [PATCH v3] watchdog: orion_wdt: Propagate errors from optional IRQ lookup
@ 2026-08-10 8:26 phucduc.bui
2026-08-10 14:29 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: phucduc.bui @ 2026-08-10 8:26 UTC (permalink / raw)
To: Wim Van Sebroeck, Guenter Roeck, linux-watchdog
Cc: 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 IRQ is available, while other errors should be propagated.
Propagate errors such as -EPROBE_DEFER and -EINVAL instead of continuing
probe without the IRQ.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
Link v2 :
https://lore.kernel.org/all/20260807080447.35479-1-phucduc.bui@gmail.com/
Changes in v3:
- Use goto disable_clk instead of returning directly.
- Add similar error handling for the second platform_get_irq_optional() call.
drivers/watchdog/orion_wdt.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
index 0e145f762f6f..6715186aeac4 100644
--- a/drivers/watchdog/orion_wdt.c
+++ b/drivers/watchdog/orion_wdt.c
@@ -606,6 +606,10 @@ static int orion_wdt_probe(struct platform_device *pdev)
/* Request the IRQ only after the watchdog is disabled */
irq = platform_get_irq_optional(pdev, 0);
+ if (irq < 0 && irq != -ENXIO) {
+ ret = irq;
+ goto disable_clk;
+ }
if (irq > 0) {
/*
* Not all supported platforms specify an interrupt for the
@@ -621,6 +625,10 @@ static int orion_wdt_probe(struct platform_device *pdev)
/* Optional 2nd interrupt for pretimeout */
irq = platform_get_irq_optional(pdev, 1);
+ if (irq < 0 && irq != -ENXIO) {
+ ret = irq;
+ goto disable_clk;
+ }
if (irq > 0) {
orion_wdt_info.options |= WDIOF_PRETIMEOUT;
ret = devm_request_irq(&pdev->dev, irq, orion_wdt_pre_irq,
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3] watchdog: orion_wdt: Propagate errors from optional IRQ lookup
2026-08-10 8:26 [PATCH v3] watchdog: orion_wdt: Propagate errors from optional IRQ lookup phucduc.bui
@ 2026-08-10 14:29 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2026-08-10 14:29 UTC (permalink / raw)
To: phucduc.bui; +Cc: Wim Van Sebroeck, linux-watchdog, linux-kernel
On Mon, Aug 10, 2026 at 03:26:05PM +0700, phucduc.bui@gmail.com wrote:
> 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 IRQ is available, while other errors should be propagated.
>
> Propagate errors such as -EPROBE_DEFER and -EINVAL instead of continuing
> probe without the IRQ.
>
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Applied.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-10 14:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-10 8:26 [PATCH v3] watchdog: orion_wdt: Propagate errors from optional IRQ lookup phucduc.bui
2026-08-10 14:29 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox