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

Patrice CHOTARD patrice.chotard at foss.st.com
Sun Nov 29 23:44:29 PST 2026



On 11/29/26 08:26, Arina Kharlamova via B4 Relay wrote:
> 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>

Hi Arina

Reviewed-by: Patrice Chotard <patrice.chotard at foss.st.com>

Thanks
Patrice





More information about the linux-arm-kernel mailing list