From: sashiko-bot@kernel.org
To: "Luca Leonardo Scorcia" <l.scorcia@gmail.com>
Cc: linux-watchdog@vger.kernel.org, conor+dt@kernel.org,
devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v4 5/7] watchdog: mediatek: Add support for mt8167 toprgu/watchdog
Date: Wed, 19 Aug 2026 10:29:41 +0000 [thread overview]
Message-ID: <20260819102942.1841F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260819101853.44681-6-l.scorcia@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Race condition in watchdog registration exposing uninitialized device properties.
--
--- Patch [5]: [PATCH v4 5/7] watchdog: mediatek: Add support for mt8167 toprgu/watchdog ---
commit 918b68ccd6f0fbc5fe13cfd642a3baccbeddc0ed
Author: Luca Leonardo Scorcia <l.scorcia@gmail.com>
watchdog: mediatek: Add support for mt8167 toprgu/watchdog
This commit adds support for the Top Reset Generation Unit/Watchdog Timer
found on the mt8167 SoC. It uses a reset table to handle non-contiguous
reset bits and ensures the reset controller is registered with the correct
configuration.
> diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
> index f8208fb0f7234..fa522fd80dd45 100644
> --- a/drivers/watchdog/mtk_wdt.c
> +++ b/drivers/watchdog/mtk_wdt.c
[ ... ]
> @@ -457,12 +493,14 @@ static int mtk_wdt_probe(struct platform_device *pdev)
>
> wdt_data = of_device_get_match_data(dev);
> if (wdt_data) {
[ ... ]
> err = toprgu_register_reset_controller(pdev,
> wdt_data->toprgu_sw_rst_num);
> if (err)
> return err;
> -
> - mtk_wdt->has_swsysrst_en = wdt_data->has_swsysrst_en;
> }
>
> mtk_wdt->disable_wdt_extrst =
[Severity: High]
This is a pre-existing issue, but does the ordering in mtk_wdt_probe()
create a race condition with userspace?
Looking at the probe function, devm_watchdog_register_device() is called
and exposes the device to userspace before the hardware-specific properties
disable_wdt_extrst and reset_by_toprgu are populated.
If udev or another userspace process opens the watchdog device immediately
upon registration, could mtk_wdt_start() execute before these properties
are initialized?
If so, mtk_wdt_start() would evaluate the properties as false:
mtk_wdt_start() {
...
if (mtk_wdt->disable_wdt_extrst)
reg &= ~WDT_MODE_EXRST_EN;
if (mtk_wdt->reset_by_toprgu)
reg |= WDT_MODE_CNT_SEL;
...
}
Could this lead to incorrectly asserting external reset signals or failing
to trigger the proper TOPRGU reset path? Should the watchdog registration
be deferred until all device tree properties are fully parsed?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260819101853.44681-1-l.scorcia@gmail.com?part=5
next prev parent reply other threads:[~2026-08-19 10:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-19 10:16 [PATCH v4 0/7] Properly describe mt6589 and mt8167 toprgu resets Luca Leonardo Scorcia
2026-08-19 10:16 ` [PATCH v4 1/7] dt-bindings: reset: Add mt6589 toprgu reset IDs Luca Leonardo Scorcia
2026-08-19 10:16 ` [PATCH v4 2/7] watchdog: mediatek: Add wdt/toprgu resets for mt6589 Luca Leonardo Scorcia
2026-08-19 10:30 ` sashiko-bot
2026-08-19 10:16 ` [PATCH v4 3/7] arm: dts: mediatek: mt6589: Enable toprgu reset controller Luca Leonardo Scorcia
2026-08-19 10:16 ` [PATCH v4 4/7] dt-bindings: watchdog: Add compatible for MediaTek mt8167 Luca Leonardo Scorcia
2026-08-19 10:29 ` sashiko-bot
2026-08-19 10:16 ` [PATCH v4 5/7] watchdog: mediatek: Add support for mt8167 toprgu/watchdog Luca Leonardo Scorcia
2026-08-19 10:29 ` sashiko-bot [this message]
2026-08-19 10:16 ` [PATCH v4 6/7] soc: mediatek: mtk-mmsys: Add resets for mt8167 Luca Leonardo Scorcia
2026-08-19 10:16 ` [PATCH v4 7/7] arm64: dts: mt8167: Properly describe the SoC watchdog and mmsys resets Luca Leonardo Scorcia
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=20260819102942.1841F1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=l.scorcia@gmail.com \
--cc=linux-watchdog@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.