* [PATCH] spi: nxp-fspi: Fix runtime PM leak in nxp_fspi_probe()
@ 2026-09-17 15:37 Wentao Liang
2026-09-17 18:39 ` Frank Li
0 siblings, 1 reply; 3+ messages in thread
From: Wentao Liang @ 2026-09-17 15:37 UTC (permalink / raw)
To: broonie
Cc: haibo.chen, han.xu, imx, linux-kernel, linux-spi, yogeshgaur.83,
Wentao Liang, stable
pm_runtime_get_sync() increments the runtime PM usage counter even when
it fails. If it returns an error, nxp_fspi_probe() returns without
dropping that reference, so the counter stays unbalanced.
Balance the counter with pm_runtime_put_noidle() before returning, as
nxp_fspi_remove() already does.
Fixes: 97be4b919a60 ("spi: spi-nxp-fspi: enable runtime pm for fspi")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/spi/spi-nxp-fspi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
index 1e36ae084dd8..9883e5149dc4 100644
--- a/drivers/spi/spi-nxp-fspi.c
+++ b/drivers/spi/spi-nxp-fspi.c
@@ -1351,8 +1351,10 @@ static int nxp_fspi_probe(struct platform_device *pdev)
/* enable clock */
ret = pm_runtime_get_sync(f->dev);
- if (ret < 0)
+ if (ret < 0) {
+ pm_runtime_put_noidle(f->dev);
return dev_err_probe(dev, ret, "Failed to enable clock");
+ }
/* Clear potential interrupts */
reg = fspi_readl(f, f->iobase + FSPI_INTR);
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] spi: nxp-fspi: Fix runtime PM leak in nxp_fspi_probe()
2026-09-17 15:37 [PATCH] spi: nxp-fspi: Fix runtime PM leak in nxp_fspi_probe() Wentao Liang
@ 2026-09-17 18:39 ` Frank Li
2026-09-17 19:26 ` Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: Frank Li @ 2026-09-17 18:39 UTC (permalink / raw)
To: Wentao Liang
Cc: broonie, haibo.chen, han.xu, imx, linux-kernel, linux-spi,
yogeshgaur.83, stable
On Thu, Sep 17, 2026 at 03:37:13PM +0000, Wentao Liang wrote:
> pm_runtime_get_sync() increments the runtime PM usage counter even when
> it fails. If it returns an error, nxp_fspi_probe() returns without
> dropping that reference, so the counter stays unbalanced.
>
> Balance the counter with pm_runtime_put_noidle() before returning, as
> nxp_fspi_remove() already does.
>
> Fixes: 97be4b919a60 ("spi: spi-nxp-fspi: enable runtime pm for fspi")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> drivers/spi/spi-nxp-fspi.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
> index 1e36ae084dd8..9883e5149dc4 100644
> --- a/drivers/spi/spi-nxp-fspi.c
> +++ b/drivers/spi/spi-nxp-fspi.c
> @@ -1351,8 +1351,10 @@ static int nxp_fspi_probe(struct platform_device *pdev)
>
> /* enable clock */
> ret = pm_runtime_get_sync(f->dev);
> - if (ret < 0)
> + if (ret < 0) {
> + pm_runtime_put_noidle(f->dev);
> return dev_err_probe(dev, ret, "Failed to enable clock");
> + }
use pm_runtime_resume_and_get()
Frank
>
> /* Clear potential interrupts */
> reg = fspi_readl(f, f->iobase + FSPI_INTR);
> --
> 2.34.1
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] spi: nxp-fspi: Fix runtime PM leak in nxp_fspi_probe()
2026-09-17 18:39 ` Frank Li
@ 2026-09-17 19:26 ` Mark Brown
0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-09-17 19:26 UTC (permalink / raw)
To: Frank Li
Cc: Wentao Liang, haibo.chen, han.xu, imx, linux-kernel, linux-spi,
yogeshgaur.83, stable
[-- Attachment #1: Type: text/plain, Size: 669 bytes --]
On Thu, Sep 17, 2026 at 01:39:06PM -0500, Frank Li wrote:
> On Thu, Sep 17, 2026 at 03:37:13PM +0000, Wentao Liang wrote:
> > pm_runtime_get_sync() increments the runtime PM usage counter even when
> > it fails. If it returns an error, nxp_fspi_probe() returns without
> > dropping that reference, so the counter stays unbalanced.
> use pm_runtime_resume_and_get()
This also doesn't apply against current code, please check that when you
resend.
Please delete unneeded context from mails when replying. Doing this
makes it much easier to find your reply in the message, helping ensure
it won't be missed by people scrolling through the irrelevant quoted
material.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-17 19:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-17 15:37 [PATCH] spi: nxp-fspi: Fix runtime PM leak in nxp_fspi_probe() Wentao Liang
2026-09-17 18:39 ` Frank Li
2026-09-17 19:26 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®