[PATCH] spi: stm32-ospi: Fix runtime PM leak on resume error

Arina Kharlamova via B4 Relay devnull+arina.kharlamova.mbzuai.ac.ae at kernel.org
Sat Nov 28 23:26:48 PST 2026


From: Arina Kharlamova <arina.kharlamova at mbzuai.ac.ae>

stm32_ospi_resume() returns when reset_control_acquire() fails, after
pm_runtime_resume_and_get() has taken a reference. The reference is not
dropped, so each failed resume leaks one usage count.

Drop the reference on that error path.

Fixes: cf2c3eceb757 ("spi: stm32-ospi: Make usage of reset_control_acquire/release() API")
Signed-off-by: Arina Kharlamova <arina.kharlamova at mbzuai.ac.ae>
---
Found by checks derived from the spec2patch kernel API specifications,
with the help of an AI coding assistant (Claude); I reviewed the
analysis and the fix.
---
 drivers/spi/spi-stm32-ospi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spi/spi-stm32-ospi.c b/drivers/spi/spi-stm32-ospi.c
index fa0e8e83cb1b..21fe0fbc9cfa 100644
--- a/drivers/spi/spi-stm32-ospi.c
+++ b/drivers/spi/spi-stm32-ospi.c
@@ -1035,6 +1035,7 @@ static int stm32_ospi_resume(struct device *dev)
 	ret = reset_control_acquire(ospi->rstc);
 	if (ret) {
 		dev_err(dev, "Can not acquire reset\n");
+		pm_runtime_put_autosuspend(ospi->dev);
 		return ret;
 	}
 

---
base-commit: 25faec9ce61c01fb45abf812a222c5b43c3cd5c5
change-id: 20261129-s2p-c25-4da9c48c734d

Best regards,
--  
Arina Kharlamova <arina.kharlamova at mbzuai.ac.ae>





More information about the linux-arm-kernel mailing list