From: sashiko-bot@kernel.org
To: zhaofeng2@cmss.chinamobile.com
Cc: linux-watchdog@vger.kernel.org
Subject: Re: [PATCH] watchdog: npcm: fix sleeping clock call in restart handler
Date: Wed, 11 Nov 2026 06:54:32 +0000 [thread overview]
Message-ID: <sashiko-outbox-208470@kernel.org> (raw)
In-Reply-To: <20261111064150.260-1-zhaofeng2@cmss.chinamobile.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] watchdog: npcm: open-coded devm_clk_get_optional_prepared() in
npcm_wdt_probe()
--
commit d887f7d373bb7c1fa8a0907fd176d60b84597a65
Author: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
watchdog: npcm: fix sleeping clock call in restart handler
This commit prepares the watchdog clock at probe time and registers a devm
cleanup action so that npcm_wdt_restart() can call clk_enable() in atomic
context instead of clk_prepare_enable().
> diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c
> index 4d8f212871447..4fb17f758cdbc 100644
> --- a/drivers/watchdog/npcm_wdt.c
> +++ b/drivers/watchdog/npcm_wdt.c
[ ... ]
> @@ -386,6 +390,11 @@ static const struct watchdog_ops npcm_wdt_ops = {
> .restart = npcm_wdt_restart,
> };
>
> +static void npcm_clk_unprepare(void *data)
> +{
> + clk_unprepare(data);
> +}
> +
> static int npcm_wdt_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> @@ -414,6 +423,20 @@ static int npcm_wdt_probe(struct platform_device *pdev)
> if (IS_ERR(wdt->clk))
> return PTR_ERR(wdt->clk);
>
> + /*
> + * Prepare the clock once and keep it prepared for the lifetime
> + * of the driver: npcm_wdt_restart() runs in atomic context and
> + * may only call clk_enable().
> + */
> + ret = clk_prepare(wdt->clk);
> + if (ret)
> + return ret;
> +
> + ret = devm_add_action_or_reset(&pdev->dev, npcm_clk_unprepare,
> + wdt->clk);
> + if (ret)
> + return ret;
[Severity: Low]
Could devm_clk_get_optional_prepared(&pdev->dev, NULL) be used here
instead of open-coding clk_prepare(), devm_add_action_or_reset(), and
npcm_clk_unprepare()? Also, since wdt->clk now stays prepared for the
lifetime of the driver, npcm_wdt_start() and npcm_wdt_stop() only need
clk_enable() and clk_disable() rather than clk_prepare_enable() and
clk_disable_unprepare().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261111064150.260-1-zhaofeng2@cmss.chinamobile.com?part=1
next prev parent reply other threads:[~2026-11-11 6:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 6:41 [PATCH] watchdog: npcm: fix sleeping clock call in restart handler zhaofeng2
2026-11-11 6:54 ` sashiko-bot [this message]
2026-11-11 8:32 ` [PATCH v2] " zhaofeng2
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=sashiko-outbox-208470@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=zhaofeng2@cmss.chinamobile.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 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.