From: phucduc.bui@gmail.com
To: Wim Van Sebroeck <wim@linux-watchdog.org>,
Guenter Roeck <linux@roeck-us.net>,
linux-watchdog@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, bui duc phuc <phucduc.bui@gmail.com>
Subject: [PATCH v3] watchdog: orion_wdt: Propagate errors from optional IRQ lookup
Date: Mon, 10 Aug 2026 15:26:05 +0700 [thread overview]
Message-ID: <20260810082606.42623-1-phucduc.bui@gmail.com> (raw)
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
next reply other threads:[~2026-08-10 8:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 8:26 phucduc.bui [this message]
2026-08-10 8:36 ` [PATCH v3] watchdog: orion_wdt: Propagate errors from optional IRQ lookup sashiko-bot
2026-08-10 14:28 ` Guenter Roeck
2026-08-10 14:29 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260810082606.42623-1-phucduc.bui@gmail.com \
--to=phucduc.bui@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=wim@linux-watchdog.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.