From: sashiko-bot@kernel.org
To: "Triet Hoang" <triet.hoang.dev@gmail.com>
Cc: linux-watchdog@vger.kernel.org
Subject: Re: [PATCH v2 4/8] watchdog: msc313e_wdt: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
Date: Mon, 14 Sep 2026 09:20:11 +0000 [thread overview]
Message-ID: <20260914092012.20B861F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260914085451.891675-5-triet.hoang.dev@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The msc313e_wdt_resume() callback ignores the return value of msc313e_wdt_start(). If clk_prepare_enable() fails, the clock remains disabled but the watchdog core state still considers it active/running. Subsequent watchdog operations (like ping) will perform blind writes to unclocked hardware registers (e.g., REG_WDT_CLR), leading to a system crash. Additionally, any subsequent stop() call will incorrectly decrement the clock's reference count.
--
commit e0ef26398a011a110179678902a905e77bb75d61
Author: Triet Hoang <triet.hoang.dev@gmail.com>
watchdog: msc313e_wdt: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
This commit converts the deprecated SIMPLE_DEV_PM_OPS() macro to
DEFINE_SIMPLE_DEV_PM_OPS() and uses pm_ptr(). It also removes the
__maybe_unused annotations from the suspend and resume callbacks.
> diff --git a/drivers/watchdog/msc313e_wdt.c b/drivers/watchdog/msc313e_wdt.c
> index 4a5cce2a16b18..a77ff57a44571 100644
> --- a/drivers/watchdog/msc313e_wdt.c
> +++ b/drivers/watchdog/msc313e_wdt.c
[ ... ]
> -static int __maybe_unused msc313e_wdt_resume(struct device *dev)
> +static int msc313e_wdt_resume(struct device *dev)
> {
> struct msc313e_wdt_priv *priv = dev_get_drvdata(dev);
>
> if (watchdog_active(&priv->wdev) || watchdog_hw_running(&priv->wdev))
> msc313e_wdt_start(&priv->wdev);
>
> return 0;
[Severity: High]
This is a pre-existing issue, but does msc313e_wdt_resume() need to handle
the return value of msc313e_wdt_start()?
If clk_prepare_enable() fails inside msc313e_wdt_start():
msc313e_wdt_start() {
...
err = clk_prepare_enable(priv->clk);
if (err)
return err;
...
}
The error is returned to msc313e_wdt_resume(), which discards it and returns
0. Because the watchdog core state still considers the hardware active,
could subsequent operations like watchdog ping perform writes to unclocked
hardware registers (such as REG_WDT_CLR) and trigger a bus fault or system
crash?
Additionally, if the clock remains disabled but the watchdog is still tracked
as running, will a subsequent stop() call incorrectly decrement the clock's
enable reference count?
> }
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260914085451.891675-1-triet.hoang.dev@gmail.com?part=4
next prev parent reply other threads:[~2026-09-14 9:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 8:54 [PATCH v2 0/8] watchdog: Convert drivers to DEFINE_SIMPLE_DEV_PM_OPS() Triet Hoang
2026-09-14 8:54 ` [PATCH v2 1/8] watchdog: cadence_wdt: Convert " Triet Hoang
2026-09-16 3:28 ` Tzung-Bi Shih
2026-09-16 4:54 ` Triet Hoang
2026-09-14 8:54 ` [PATCH v2 2/8] watchdog: da9062: " Triet Hoang
2026-09-14 8:54 ` [PATCH v2 3/8] watchdog: keembay_wdt: " Triet Hoang
2026-09-14 9:11 ` sashiko-bot
2026-09-14 9:21 ` Triet Hoang
2026-09-14 8:54 ` [PATCH v2 4/8] watchdog: msc313e_wdt: " Triet Hoang
2026-09-14 9:20 ` sashiko-bot [this message]
2026-09-16 3:35 ` Tzung-Bi Shih
2026-09-14 8:54 ` [PATCH v2 5/8] watchdog: of_xilinx_wdt: " Triet Hoang
2026-09-14 8:54 ` [PATCH v2 6/8] watchdog: pm8916_wdt: " Triet Hoang
2026-09-14 9:33 ` sashiko-bot
2026-09-14 8:54 ` [PATCH v2 7/8] watchdog: sp805_wdt: " Triet Hoang
2026-09-14 8:54 ` [PATCH v2 8/8] watchdog: stmp3xxx_rtc_wdt: " Triet Hoang
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=20260914092012.20B861F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=triet.hoang.dev@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox