mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [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

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®