* [PATCH 2/4] watchdog: mediatek: Propagate errors from optional IRQ lookup
2026-08-07 8:16 [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup phucduc.bui
@ 2026-08-07 8:16 ` phucduc.bui
2026-08-09 15:02 ` Guenter Roeck
2026-08-07 8:16 ` [PATCH 3/4] watchdog: dw_wdt: " phucduc.bui
` (3 subsequent siblings)
4 siblings, 1 reply; 20+ messages in thread
From: phucduc.bui @ 2026-08-07 8:16 UTC (permalink / raw)
To: Wim Van Sebroeck, Guenter Roeck, Joel Stanley, Andrew Jeffery,
AngeloGioacchino Del Regno
Cc: linux-arm-msm, linux-mediatek, linux-watchdog, linux-kernel,
linux-aspeed, linux-arm-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.
Instead of only checking for -EPROBE_DEFER, propagate all error codes
returned by platform_get_irq_optional() other than -ENXIO, so that
failures are properly reported to the caller.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
drivers/watchdog/mtk_wdt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
index 91d110646e16..d9c30e4c80e3 100644
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -422,8 +422,8 @@ static int mtk_wdt_probe(struct platform_device *pdev)
mtk_wdt->wdt_dev.info = &mtk_wdt_pt_info;
mtk_wdt->wdt_dev.pretimeout = WDT_MAX_TIMEOUT / 2;
} else {
- if (irq == -EPROBE_DEFER)
- return -EPROBE_DEFER;
+ if (irq != -ENXIO)
+ return irq;
mtk_wdt->wdt_dev.info = &mtk_wdt_info;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 2/4] watchdog: mediatek: Propagate errors from optional IRQ lookup
2026-08-07 8:16 ` [PATCH 2/4] watchdog: mediatek: " phucduc.bui
@ 2026-08-09 15:02 ` Guenter Roeck
0 siblings, 0 replies; 20+ messages in thread
From: Guenter Roeck @ 2026-08-09 15:02 UTC (permalink / raw)
To: phucduc.bui
Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel
On Fri, Aug 07, 2026 at 03:16:50PM +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.
>
> Instead of only checking for -EPROBE_DEFER, propagate all error codes
> returned by platform_get_irq_optional() other than -ENXIO, so that
> failures are properly reported to the caller.
>
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Applied.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 3/4] watchdog: dw_wdt: Propagate errors from optional IRQ lookup
2026-08-07 8:16 [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup phucduc.bui
2026-08-07 8:16 ` [PATCH 2/4] watchdog: mediatek: " phucduc.bui
@ 2026-08-07 8:16 ` phucduc.bui
2026-08-07 8:48 ` sashiko-bot
2026-08-09 15:03 ` Guenter Roeck
2026-08-07 8:16 ` [PATCH 4/4] watchdog: aspeed: " phucduc.bui
` (2 subsequent siblings)
4 siblings, 2 replies; 20+ messages in thread
From: phucduc.bui @ 2026-08-07 8:16 UTC (permalink / raw)
To: Wim Van Sebroeck, Guenter Roeck, Joel Stanley, Andrew Jeffery,
AngeloGioacchino Del Regno
Cc: linux-arm-msm, linux-mediatek, linux-watchdog, linux-kernel,
linux-aspeed, linux-arm-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.
Instead of only checking for -EPROBE_DEFER, propagate all error codes
returned by platform_get_irq_optional() other than -ENXIO, so that
failures are properly reported to the caller.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
drivers/watchdog/dw_wdt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index c3fbb6068c52..39031445d754 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -611,7 +611,7 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
dw_wdt->wdd.info = &dw_wdt_pt_ident;
} else {
- if (ret == -EPROBE_DEFER)
+ if (ret != -ENXIO)
return ret;
dw_wdt->wdd.info = &dw_wdt_ident;
--
2.43.0
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 3/4] watchdog: dw_wdt: Propagate errors from optional IRQ lookup
2026-08-07 8:16 ` [PATCH 3/4] watchdog: dw_wdt: " phucduc.bui
@ 2026-08-07 8:48 ` sashiko-bot
2026-08-09 15:03 ` Guenter Roeck
1 sibling, 0 replies; 20+ messages in thread
From: sashiko-bot @ 2026-08-07 8:48 UTC (permalink / raw)
To: phucduc.bui; +Cc: linux-watchdog
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Hardware register access and shared IRQ registration occur before device is taken out of reset, which can cause an external abort or bus stall. This problem wasn't introduced by this patch, but it is a critical hardware lifecycle violation.
--
--- Patch [3]: [PATCH 3/4] watchdog: dw_wdt: Propagate errors from optional IRQ lookup ---
commit 415108e73d198e9211e81c51098b9fd10a005104
Author: bui duc phuc <phucduc.bui@gmail.com>
watchdog: dw_wdt: Propagate errors from optional IRQ lookup
This commit modifies dw_wdt_drv_probe() to propagate all error codes
returned by platform_get_irq_optional() other than -ENXIO. This ensures
failures are properly reported to the caller instead of only checking
for -EPROBE_DEFER.
> diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
> index c3fbb6068c520..39031445d754b 100644
> --- a/drivers/watchdog/dw_wdt.c
> +++ b/drivers/watchdog/dw_wdt.c
> @@ -611,7 +611,7 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
>
> dw_wdt->wdd.info = &dw_wdt_pt_ident;
> } else {
> - if (ret == -EPROBE_DEFER)
> + if (ret != -ENXIO)
> return ret;
>
> dw_wdt->wdd.info = &dw_wdt_ident;
[Severity: High]
This is a pre-existing issue, but does this function perform register accesses
and register a shared interrupt before the device is taken out of reset?
Looking at the sequence of operations in dw_wdt_drv_probe():
dw_wdt_drv_probe() {
...
/* Enable normal reset without pre-timeout by default. */
dw_wdt_update_mode(dw_wdt, DW_WDT_RMOD_RESET);
...
ret = devm_request_irq(dev, ret, dw_wdt_irq, IRQF_SHARED ...);
...
reset_control_deassert(dw_wdt->rst);
...
}
If the hardware starts in a reset state, could the register I/O inside
dw_wdt_update_mode() trigger a synchronous external abort or system hang
because it occurs before reset_control_deassert() is called?
Additionally, since devm_request_irq() is called with IRQF_SHARED before
the reset is deasserted, if another device on the same IRQ line triggers
an interrupt, would dw_wdt_irq() execute and attempt to read the watchdog
interrupt status register while the device is still held in reset?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260807081652.38692-1-phucduc.bui@gmail.com?part=3
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 3/4] watchdog: dw_wdt: Propagate errors from optional IRQ lookup
2026-08-07 8:16 ` [PATCH 3/4] watchdog: dw_wdt: " phucduc.bui
2026-08-07 8:48 ` sashiko-bot
@ 2026-08-09 15:03 ` Guenter Roeck
1 sibling, 0 replies; 20+ messages in thread
From: Guenter Roeck @ 2026-08-09 15:03 UTC (permalink / raw)
To: phucduc.bui
Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel
On Fri, Aug 07, 2026 at 03:16:51PM +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.
>
> Instead of only checking for -EPROBE_DEFER, propagate all error codes
> returned by platform_get_irq_optional() other than -ENXIO, so that
> failures are properly reported to the caller.
>
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Applied.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 4/4] watchdog: aspeed: Propagate errors from optional IRQ lookup
2026-08-07 8:16 [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup phucduc.bui
2026-08-07 8:16 ` [PATCH 2/4] watchdog: mediatek: " phucduc.bui
2026-08-07 8:16 ` [PATCH 3/4] watchdog: dw_wdt: " phucduc.bui
@ 2026-08-07 8:16 ` phucduc.bui
2026-08-09 15:05 ` Guenter Roeck
2026-08-10 4:34 ` Guenter Roeck
2026-08-07 8:25 ` [PATCH 1/4] watchdog: qcom: " sashiko-bot
2026-08-08 0:23 ` Guenter Roeck
4 siblings, 2 replies; 20+ messages in thread
From: phucduc.bui @ 2026-08-07 8:16 UTC (permalink / raw)
To: Wim Van Sebroeck, Guenter Roeck, Joel Stanley, Andrew Jeffery,
AngeloGioacchino Del Regno
Cc: linux-arm-msm, linux-mediatek, linux-watchdog, linux-kernel,
linux-aspeed, linux-arm-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>
---
drivers/watchdog/aspeed_wdt.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
index c9e79851504c..48454ac86074 100644
--- a/drivers/watchdog/aspeed_wdt.c
+++ b/drivers/watchdog/aspeed_wdt.c
@@ -429,6 +429,8 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
if (wdt->cfg->irq_mask) {
int irq = platform_get_irq_optional(pdev, 0);
+ if (irq < 0 && irq != -ENXIO)
+ return irq;
if (irq > 0) {
ret = devm_request_irq(dev, irq, aspeed_wdt_irq,
IRQF_SHARED, dev_name(dev),
--
2.43.0
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 4/4] watchdog: aspeed: Propagate errors from optional IRQ lookup
2026-08-07 8:16 ` [PATCH 4/4] watchdog: aspeed: " phucduc.bui
@ 2026-08-09 15:05 ` Guenter Roeck
2026-08-10 2:38 ` Bui Duc Phuc
2026-08-10 4:34 ` Guenter Roeck
1 sibling, 1 reply; 20+ messages in thread
From: Guenter Roeck @ 2026-08-09 15:05 UTC (permalink / raw)
To: phucduc.bui
Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel
On Fri, Aug 07, 2026 at 03:16:52PM +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>
> ---
> drivers/watchdog/aspeed_wdt.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
> index c9e79851504c..48454ac86074 100644
> --- a/drivers/watchdog/aspeed_wdt.c
> +++ b/drivers/watchdog/aspeed_wdt.c
> @@ -429,6 +429,8 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
> if (wdt->cfg->irq_mask) {
> int irq = platform_get_irq_optional(pdev, 0);
>
> + if (irq < 0 && irq != -ENXIO)
> + return irq;
> if (irq > 0) {
This if () is no longer needed.
Thanks,
Guenter
> ret = devm_request_irq(dev, irq, aspeed_wdt_irq,
> IRQF_SHARED, dev_name(dev),
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 4/4] watchdog: aspeed: Propagate errors from optional IRQ lookup
2026-08-09 15:05 ` Guenter Roeck
@ 2026-08-10 2:38 ` Bui Duc Phuc
2026-08-10 3:58 ` Guenter Roeck
0 siblings, 1 reply; 20+ messages in thread
From: Bui Duc Phuc @ 2026-08-10 2:38 UTC (permalink / raw)
To: Guenter Roeck
Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel
Hi Guenter,
Thank you for your review.
> > + if (irq < 0 && irq != -ENXIO)
> > + return irq;
> > if (irq > 0) {
>
> This if () is no longer needed.
>
If we remove the if (irq > 0) check, irq can be -ENXIO and would be
passed to devm_request_irq().
I see that the irq argument of devm_request_irq() is an unsigned int.
Would it be safe to pass -ENXIO to it in this case?
Best regards,
Phuc
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 4/4] watchdog: aspeed: Propagate errors from optional IRQ lookup
2026-08-10 2:38 ` Bui Duc Phuc
@ 2026-08-10 3:58 ` Guenter Roeck
2026-08-10 9:45 ` Bui Duc Phuc
0 siblings, 1 reply; 20+ messages in thread
From: Guenter Roeck @ 2026-08-10 3:58 UTC (permalink / raw)
To: Bui Duc Phuc
Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel
On 8/9/26 19:38, Bui Duc Phuc wrote:
> Hi Guenter,
>
> Thank you for your review.
>
>>> + if (irq < 0 && irq != -ENXIO)
>>> + return irq;
>>> if (irq > 0) {
>>
>> This if () is no longer needed.
>>
>
> If we remove the if (irq > 0) check, irq can be -ENXIO and would be
> passed to devm_request_irq().
> I see that the irq argument of devm_request_irq() is an unsigned int.
> Would it be safe to pass -ENXIO to it in this case?
>
No, sorry, I was wrong.
Guenter
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 4/4] watchdog: aspeed: Propagate errors from optional IRQ lookup
2026-08-10 3:58 ` Guenter Roeck
@ 2026-08-10 9:45 ` Bui Duc Phuc
2026-08-10 14:24 ` Guenter Roeck
0 siblings, 1 reply; 20+ messages in thread
From: Bui Duc Phuc @ 2026-08-10 9:45 UTC (permalink / raw)
To: Guenter Roeck
Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel
Hi Guenter,
Thank you for your feedback.
> >>> + return irq;
> >>> if (irq > 0) {
> >>
> >> This if () is no longer needed.
> >>
> >
> > If we remove the if (irq > 0) check, irq can be -ENXIO and would be
> > passed to devm_request_irq().
> > I see that the irq argument of devm_request_irq() is an unsigned int.
> > Would it be safe to pass -ENXIO to it in this case?
> >
> No, sorry, I was wrong.
>
So this means there are no issues with this patch.
Patches 2 and 3 have already been applied by you.
I will temporarily resend only patch 1:
" watchdog: qcom: Propagate errors from optional IRQ lookup "
Best regards,
Phuc
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 4/4] watchdog: aspeed: Propagate errors from optional IRQ lookup
2026-08-10 9:45 ` Bui Duc Phuc
@ 2026-08-10 14:24 ` Guenter Roeck
0 siblings, 0 replies; 20+ messages in thread
From: Guenter Roeck @ 2026-08-10 14:24 UTC (permalink / raw)
To: Bui Duc Phuc
Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel
On Mon, Aug 10, 2026 at 04:45:07PM +0700, Bui Duc Phuc wrote:
> Hi Guenter,
>
>
> Thank you for your feedback.
>
> > >>> + return irq;
> > >>> if (irq > 0) {
> > >>
> > >> This if () is no longer needed.
> > >>
> > >
> > > If we remove the if (irq > 0) check, irq can be -ENXIO and would be
> > > passed to devm_request_irq().
> > > I see that the irq argument of devm_request_irq() is an unsigned int.
> > > Would it be safe to pass -ENXIO to it in this case?
> > >
> > No, sorry, I was wrong.
> >
>
> So this means there are no issues with this patch.
> Patches 2 and 3 have already been applied by you.
> I will temporarily resend only patch 1:
> " watchdog: qcom: Propagate errors from optional IRQ lookup "
>
Correct. Note that gmail may swallow this reply, claiming that it is spam.
Guenter
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 4/4] watchdog: aspeed: Propagate errors from optional IRQ lookup
2026-08-07 8:16 ` [PATCH 4/4] watchdog: aspeed: " phucduc.bui
2026-08-09 15:05 ` Guenter Roeck
@ 2026-08-10 4:34 ` Guenter Roeck
1 sibling, 0 replies; 20+ messages in thread
From: Guenter Roeck @ 2026-08-10 4:34 UTC (permalink / raw)
To: phucduc.bui
Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel
On Fri, Aug 07, 2026 at 03:16:52PM +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] 20+ messages in thread
* Re: [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup
2026-08-07 8:16 [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup phucduc.bui
` (2 preceding siblings ...)
2026-08-07 8:16 ` [PATCH 4/4] watchdog: aspeed: " phucduc.bui
@ 2026-08-07 8:25 ` sashiko-bot
2026-08-08 0:23 ` Guenter Roeck
4 siblings, 0 replies; 20+ messages in thread
From: sashiko-bot @ 2026-08-07 8:25 UTC (permalink / raw)
To: phucduc.bui; +Cc: linux-watchdog
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The probe function aborts and returns an invalid positive value if an optional IRQ is defined but the hardware variant does not support pretimeout.
--
--- Patch [1]: [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup ---
commit 29f7b7cd8d0f4e915e9e20f6974535c663f1a3b4
Author: bui duc phuc <phucduc.bui@gmail.com>
watchdog: qcom: Propagate errors from optional IRQ lookup
This commit updates the error handling for an optional interrupt lookup
in the Qualcomm watchdog probe. Instead of only checking for -EPROBE_DEFER,
it attempts to propagate all errors except -ENXIO to better report failures.
> diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c
> index a425902b9f68d..2d9f79101b494 100644
> --- a/drivers/watchdog/qcom-wdt.c
> +++ b/drivers/watchdog/qcom-wdt.c
> @@ -314,8 +314,8 @@ static int qcom_wdt_probe(struct platform_device *pdev)
> wdt->wdd.info = &qcom_wdt_pt_info;
> wdt->wdd.pretimeout = 1;
> } else {
> - if (irq == -EPROBE_DEFER)
> - return -EPROBE_DEFER;
> + if (irq != -ENXIO)
> + return irq;
[Severity: High]
Will this cause the probe to fail on platforms where a valid IRQ is found
but pretimeout is disabled?
If platform_get_irq_optional() successfully finds an IRQ, it returns a
positive number. If the platform (such as APQ8064 or IPQ8064) provides an
interrupt in the device tree but the match data does not support pretimeout,
qcom_wdt_probe() execution falls into this else block.
Since the positive IRQ number does not equal -ENXIO, this condition evaluates
to true and the driver prematurely returns the positive IRQ number.
The driver core treats any non-zero return from probe as an error, which
aborts the watchdog initialization completely leaving the system without
watchdog protection.
Should this condition be scoped to only catch negative error codes, for
example by checking if (irq < 0 && irq != -ENXIO) before returning?
>
> wdt->wdd.info = &qcom_wdt_info;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260807081652.38692-1-phucduc.bui@gmail.com?part=1
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup
2026-08-07 8:16 [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup phucduc.bui
` (3 preceding siblings ...)
2026-08-07 8:25 ` [PATCH 1/4] watchdog: qcom: " sashiko-bot
@ 2026-08-08 0:23 ` Guenter Roeck
2026-08-08 8:59 ` Bui Duc Phuc
4 siblings, 1 reply; 20+ messages in thread
From: Guenter Roeck @ 2026-08-08 0:23 UTC (permalink / raw)
To: phucduc.bui, Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
AngeloGioacchino Del Regno
Cc: linux-arm-msm, linux-mediatek, linux-watchdog, linux-kernel,
linux-aspeed, linux-arm-kernel
On 8/7/26 01:16, 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.
>
> Instead of only checking for -EPROBE_DEFER, propagate all error codes
> returned by platform_get_irq_optional() other than -ENXIO, so that
> failures are properly reported to the caller.
>
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
> ---
> drivers/watchdog/qcom-wdt.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c
> index 49bd04841f0c..a8eb1d8f24f0 100644
> --- a/drivers/watchdog/qcom-wdt.c
> +++ b/drivers/watchdog/qcom-wdt.c
> @@ -298,8 +298,8 @@ static int qcom_wdt_probe(struct platform_device *pdev)
> wdt->wdd.info = &qcom_wdt_pt_info;
> wdt->wdd.pretimeout = 1;
> } else {
> - if (irq == -EPROBE_DEFER)
> - return -EPROBE_DEFER;
> + if (irq != -ENXIO)
> + return irq;
This is wrong. Check the if() path - the code ends up here if pretimeout == 0,
even if irq > 0.
Guenter
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup
2026-08-08 0:23 ` Guenter Roeck
@ 2026-08-08 8:59 ` Bui Duc Phuc
2026-08-08 14:51 ` Guenter Roeck
0 siblings, 1 reply; 20+ messages in thread
From: Bui Duc Phuc @ 2026-08-08 8:59 UTC (permalink / raw)
To: Guenter Roeck
Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel
Hi Guenter,
Thanks for the review.
>
> This is wrong. Check the if() path - the code ends up here if pretimeout == 0,
> even if irq > 0.
>
You're right. I misunderstood the condition in the if() path.
I'll rewrite it as follows:
irq = platform_get_irq_optional(pdev, 0);
+if (irq < 0 && irq != -ENXIO)
+ return irq;
if (data->pretimeout && irq > 0) {
.....
} else {
- if (irq == -EPROBE_DEFER)
- return -EPROBE_DEFER;
wdt->wdd.info = &qcom_wdt_info;
}
Best regards,
Phuc
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup
2026-08-08 8:59 ` Bui Duc Phuc
@ 2026-08-08 14:51 ` Guenter Roeck
2026-08-09 10:01 ` Bui Duc Phuc
0 siblings, 1 reply; 20+ messages in thread
From: Guenter Roeck @ 2026-08-08 14:51 UTC (permalink / raw)
To: Bui Duc Phuc
Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel
On 8/8/26 01:59, Bui Duc Phuc wrote:
> Hi Guenter,
>
> Thanks for the review.
>
>>
>> This is wrong. Check the if() path - the code ends up here if pretimeout == 0,
>> even if irq > 0.
>>
>
> You're right. I misunderstood the condition in the if() path.
> I'll rewrite it as follows:
>
> irq = platform_get_irq_optional(pdev, 0);
> +if (irq < 0 && irq != -ENXIO)
> + return irq;
This is still wrong. If there is no pretimeout, it does not matter if there is an error.
Guenter
> if (data->pretimeout && irq > 0) {
> .....
> } else {
> - if (irq == -EPROBE_DEFER)
> - return -EPROBE_DEFER;
> wdt->wdd.info = &qcom_wdt_info;
> }
>
> Best regards,
> Phuc
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup
2026-08-08 14:51 ` Guenter Roeck
@ 2026-08-09 10:01 ` Bui Duc Phuc
2026-08-09 14:54 ` Guenter Roeck
0 siblings, 1 reply; 20+ messages in thread
From: Bui Duc Phuc @ 2026-08-09 10:01 UTC (permalink / raw)
To: Guenter Roeck
Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel
Hi Guenter
Thank you for your review .
> > irq = platform_get_irq_optional(pdev, 0);
> > +if (irq < 0 && irq != -ENXIO)
> > + return irq;
>
> This is still wrong. If there is no pretimeout, it does not matter if there is an error.
>
If checking data->pretimeout is required here, I'd propose one of the
following approaches
let me know which one you'd prefer:
Option A (minimal diff, keep existing structure):
---------------
irq = platform_get_irq_optional(pdev, 0);
if (data->pretimeout && irq > 0) {
ret = devm_request_irq(dev, irq, qcom_wdt_isr, 0,
"wdt_bark", &wdt->wdd);
if (ret)
return ret;
wdt->wdd.info = &qcom_wdt_pt_info;
wdt->wdd.pretimeout = 1;
} else {
if (data->pretimeout && irq < 0 && irq != -ENXIO)
return irq;
wdt->wdd.info = &qcom_wdt_info;
}
------------------
Option B (check moved out, before the if/else):
------------------
irq = platform_get_irq_optional(pdev, 0);
if (data->pretimeout && irq < 0 && irq != -ENXIO)
return irq;
if (data->pretimeout && irq > 0) {
ret = devm_request_irq(dev, irq, qcom_wdt_isr, 0,
"wdt_bark", &wdt->wdd);
if (ret)
return ret;
wdt->wdd.info = &qcom_wdt_pt_info;
wdt->wdd.pretimeout = 1;
} else {
wdt->wdd.info = &qcom_wdt_info;
}
----------------------
Option C (default-then-override, only look up the IRQ when pretimeout
is supported):
----------------------
wdt->wdd.info = &qcom_wdt_info;
if (data->pretimeout) {
irq = platform_get_irq_optional(pdev, 0);
if(irq < 0 && irq != -ENXIO)
return irq;
if (irq > 0){
ret = devm_request_irq(dev, irq, qcom_wdt_isr, 0,
"wdt_bark", &wdt->wdd);
if(ret)
return ret;
wdt->wdd.info= &qcom_wdt_pt_info;
wdt->wdd.pretimeout = 1;
}
}
-----------------------
Let me know which one you think fits best, or if you'd prefer something else.
Best regards,
Phuc
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup
2026-08-09 10:01 ` Bui Duc Phuc
@ 2026-08-09 14:54 ` Guenter Roeck
2026-08-10 2:42 ` Bui Duc Phuc
0 siblings, 1 reply; 20+ messages in thread
From: Guenter Roeck @ 2026-08-09 14:54 UTC (permalink / raw)
To: Bui Duc Phuc
Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel
On 8/9/26 03:01, Bui Duc Phuc wrote:
> Hi Guenter
>
> Thank you for your review .
>
>>> irq = platform_get_irq_optional(pdev, 0);
>>> +if (irq < 0 && irq != -ENXIO)
>>> + return irq;
>>
>> This is still wrong. If there is no pretimeout, it does not matter if there is an error.
>>
>
> If checking data->pretimeout is required here, I'd propose one of the
> following approaches
> let me know which one you'd prefer:
>
> Option A (minimal diff, keep existing structure):
> ---------------
> irq = platform_get_irq_optional(pdev, 0);
> if (data->pretimeout && irq > 0) {
> ret = devm_request_irq(dev, irq, qcom_wdt_isr, 0,
> "wdt_bark", &wdt->wdd);
> if (ret)
> return ret;
>
> wdt->wdd.info = &qcom_wdt_pt_info;
> wdt->wdd.pretimeout = 1;
> } else {
> if (data->pretimeout && irq < 0 && irq != -ENXIO)
> return irq;
>
> wdt->wdd.info = &qcom_wdt_info;
> }
> ------------------
>
> Option B (check moved out, before the if/else):
>
> ------------------
> irq = platform_get_irq_optional(pdev, 0);
> if (data->pretimeout && irq < 0 && irq != -ENXIO)
> return irq;
>
> if (data->pretimeout && irq > 0) {
> ret = devm_request_irq(dev, irq, qcom_wdt_isr, 0,
> "wdt_bark", &wdt->wdd);
> if (ret)
> return ret;
>
> wdt->wdd.info = &qcom_wdt_pt_info;
> wdt->wdd.pretimeout = 1;
> } else {
> wdt->wdd.info = &qcom_wdt_info;
> }
> ----------------------
>
> Option C (default-then-override, only look up the IRQ when pretimeout
> is supported):
>
> ----------------------
> wdt->wdd.info = &qcom_wdt_info;
>
> if (data->pretimeout) {
> irq = platform_get_irq_optional(pdev, 0);
> if(irq < 0 && irq != -ENXIO)
> return irq;
>
> if (irq > 0){
> ret = devm_request_irq(dev, irq, qcom_wdt_isr, 0,
> "wdt_bark", &wdt->wdd);
> if(ret)
> return ret;
>
> wdt->wdd.info= &qcom_wdt_pt_info;
> wdt->wdd.pretimeout = 1;
> }
> }
> -----------------------
>
> Let me know which one you think fits best, or if you'd prefer something else.
>
I wpuld probably implement something like
if (data->pretimeout) {
irq = platform_get_irq_optional(pdev, 0);
if (irq < 0 && irq != -ENXIO)
return irq;
ret = devm_request_irq(dev, irq, qcom_wdt_isr, 0,
"wdt_bark", &wdt->wdd);
if (ret)
return ret;
wdt->wdd.info = &qcom_wdt_pt_info;
wdt->wdd.pretimeout = 1;
} else {
wdt->wdd.info = &qcom_wdt_info;
}
(which I think would be a combination of B and C) but ultimately it is
POV and doesn't really matter.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup
2026-08-09 14:54 ` Guenter Roeck
@ 2026-08-10 2:42 ` Bui Duc Phuc
0 siblings, 0 replies; 20+ messages in thread
From: Bui Duc Phuc @ 2026-08-10 2:42 UTC (permalink / raw)
To: Guenter Roeck
Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel
Hi Guenter,
Thank you for your feedback.
>
> I wpuld probably implement something like
>
> if (data->pretimeout) {
> irq = platform_get_irq_optional(pdev, 0);
> if (irq < 0 && irq != -ENXIO)
> return irq;
> ret = devm_request_irq(dev, irq, qcom_wdt_isr, 0,
> "wdt_bark", &wdt->wdd);
> if (ret)
> return ret;
>
> wdt->wdd.info = &qcom_wdt_pt_info;
> wdt->wdd.pretimeout = 1;
> } else {
> wdt->wdd.info = &qcom_wdt_info;
> }
>
> (which I think would be a combination of B and C) but ultimately it is
> POV and doesn't really matter.
>
I'll go with your suggested approach.
Best regards,
Phuc
^ permalink raw reply [flat|nested] 20+ messages in thread