From: sashiko-bot@kernel.org
To: "Jiawen Liu" <1298662399@qq.com>
Cc: Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH v2 1/3] spi: nxp-fspi: use devm runtime PM enablement
Date: Tue, 28 Jul 2026 08:21:04 +0000 [thread overview]
Message-ID: <20260728082104.BE14F1F00ACA@smtp.kernel.org> (raw)
In-Reply-To: <tencent_D07D657D7D49113424BFAEA7931F60DB2F06@qq.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Removing pm_runtime_disable() from nxp_fspi_cleanup() while keeping manual clock disablement causes a deterministic double clock disable (reference count underflow) on driver unbind and probe error paths.
--
--- Patch [1]: [PATCH v2 1/3] spi: nxp-fspi: use devm runtime PM enablement ---
commit 274e174a430a74bbdd5c40d6aaca37aea56ac764
Author: Jiawen Liu <1298662399@qq.com>
spi: nxp-fspi: use devm runtime PM enablement
This commit replaces open-coded runtime PM enablement with
devm_pm_runtime_enable() and uses PM_RUNTIME_ACQUIRE_AUTOSUSPEND() to
simplify the error path and avoid leaving runtime PM state behind on
failure.
> diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
> index 1e36ae084dd86..6be78712b5343 100644
> --- a/drivers/spi/spi-nxp-fspi.c
> +++ b/drivers/spi/spi-nxp-fspi.c
> @@ -1275,7 +1275,6 @@ static void nxp_fspi_cleanup(void *data)
> /* disable the hardware */
> fspi_writel(f, FSPI_MCR0_MDIS, f->iobase + FSPI_MCR0);
>
> - pm_runtime_disable(f->dev);
> pm_runtime_put_noidle(f->dev);
> nxp_fspi_clk_disable_unprep(f);
[Severity: High]
Does removing pm_runtime_disable() here cause a double clock disable
during driver unbind or late probe failure?
When devres executes nxp_fspi_cleanup(), it drops the usage count via
pm_runtime_put_noidle() and manually disables the clocks with
nxp_fspi_clk_disable_unprep(). However, the device remains in the
RPM_ACTIVE state.
Later in the devres cleanup phase, the action registered by
devm_pm_runtime_enable() executes and clears autosuspend. Because the PM
usage count is 0 and autosuspend is now disabled, the PM core
synchronously transitions the device to RPM_SUSPENDED by executing the
driver's runtime suspend callback.
Will the runtime suspend callback then blindly invoke
nxp_fspi_clk_disable_unprep() a second time, triggering a clock reference
count underflow?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260728080443.153827-1-1298662399@qq.com?part=1
next prev parent reply other threads:[~2026-07-28 8:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260728080443.153827-1-1298662399@qq.com>
2026-07-28 8:04 ` [PATCH v2 1/3] spi: nxp-fspi: use devm runtime PM enablement Jiawen Liu
2026-07-28 8:21 ` sashiko-bot [this message]
2026-07-28 8:04 ` [PATCH v2 2/3] spi: nxp-fspi: propagate default setup failures Jiawen Liu
2026-07-28 8:18 ` sashiko-bot
2026-07-28 8:04 ` [PATCH v2 3/3] spi: nxp-fspi: check runtime PM get in cleanup Jiawen Liu
2026-07-28 8:21 ` sashiko-bot
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=20260728082104.BE14F1F00ACA@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=1298662399@qq.com \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox