[PATCH] spi: stm32-ospi: Fix resource leak in remove() callback

Patrice CHOTARD patrice.chotard at foss.st.com
Sun Mar 29 23:10:22 PDT 2026



On 3/29/26 13:14, Felix Gu wrote:
> The remove() callback returned early if pm_runtime_resume_and_get()
> failed, skipping the cleanup of spi controller and other resources.
> 
> Remove the early return so cleanup completes regardless of PM resume
> result.
> 
> Fixes: 79b8a705e26c ("spi: stm32: Add OSPI driver")
> Signed-off-by: Felix Gu <ustc.gu at gmail.com>
> ---
>  drivers/spi/spi-stm32-ospi.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/spi/spi-stm32-ospi.c b/drivers/spi/spi-stm32-ospi.c
> index acf2d182e8b1..192a20de1ae6 100644
> --- a/drivers/spi/spi-stm32-ospi.c
> +++ b/drivers/spi/spi-stm32-ospi.c
> @@ -984,11 +984,8 @@ static int stm32_ospi_probe(struct platform_device *pdev)
>  static void stm32_ospi_remove(struct platform_device *pdev)
>  {
>  	struct stm32_ospi *ospi = platform_get_drvdata(pdev);
> -	int ret;
>  
> -	ret = pm_runtime_resume_and_get(ospi->dev);
> -	if (ret < 0)
> -		return;
> +	pm_runtime_resume_and_get(ospi->dev);
>  
>  	spi_unregister_controller(ospi->ctrl);
>  	/* Disable ospi */
> 
> ---
> base-commit: 3b058d1aeeeff27a7289529c4944291613b364e9
> change-id: 20260329-ospi-6aa5060f090e
> 
> Best regards,

Hi Felix

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

Thanks
Patrice



More information about the linux-arm-kernel mailing list