Unverified Commit 73cd1f97 authored by Felix Gu's avatar Felix Gu Committed by Mark Brown
Browse files

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



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: 79b8a705 ("spi: stm32: Add OSPI driver")
Signed-off-by: default avatarFelix Gu <ustc.gu@gmail.com>
Reviewed-by: default avatarPatrice Chotard <patrice.chotard@foss.st.com>
Link: https://patch.msgid.link/20260329-ospi-v1-1-cc8cf1c82c4a@gmail.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7aaa8047
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -989,11 +989,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 */