* [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup
@ 2026-08-07 8:16 phucduc.bui
2026-08-07 8:16 ` [PATCH 2/4] watchdog: mediatek: " phucduc.bui
` (4 more replies)
0 siblings, 5 replies; 9+ 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/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;
wdt->wdd.info = &qcom_wdt_info;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [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-07 8:16 ` [PATCH 3/4] watchdog: dw_wdt: " phucduc.bui
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ 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] 9+ 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-07 8:16 ` [PATCH 4/4] watchdog: aspeed: " phucduc.bui
` (2 subsequent siblings)
4 siblings, 1 reply; 9+ 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] 9+ 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-07 8:25 ` [PATCH 1/4] watchdog: qcom: " sashiko-bot
2026-08-08 0:23 ` Guenter Roeck
4 siblings, 0 replies; 9+ 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] 9+ 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; 9+ 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] 9+ 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
0 siblings, 0 replies; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ 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
0 siblings, 0 replies; 9+ 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] 9+ messages in thread
end of thread, other threads:[~2026-08-08 14:51 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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:48 ` sashiko-bot
2026-08-07 8:16 ` [PATCH 4/4] watchdog: aspeed: " phucduc.bui
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
2026-08-08 14:51 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox