Skip to content

Commit 5a570c8

Browse files
outman119broonie
authored andcommitted
spi: stm32-ospi: Fix reset control leak on probe error
When spi_register_controller() fails after reset_control_acquire() succeeds, the reset control is never released. This causes a resource leak in the error path. Add the missing reset_control_release() call in the error path. Fixes: cf2c3ec ("spi: stm32-ospi: Make usage of reset_control_acquire/release() API") Signed-off-by: Felix Gu <ustc.gu@gmail.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Link: https://patch.msgid.link/20260329-stm32-ospi-v1-1-142122466412@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 73cd1f9 commit 5a570c8

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/spi/spi-stm32-ospi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,13 +965,15 @@ static int stm32_ospi_probe(struct platform_device *pdev)
965965
if (ret) {
966966
/* Disable ospi */
967967
writel_relaxed(0, ospi->regs_base + OSPI_CR);
968-
goto err_pm_resume;
968+
goto err_reset_control;
969969
}
970970

971971
pm_runtime_put_autosuspend(ospi->dev);
972972

973973
return 0;
974974

975+
err_reset_control:
976+
reset_control_release(ospi->rstc);
975977
err_pm_resume:
976978
pm_runtime_put_sync_suspend(ospi->dev);
977979

0 commit comments

Comments
 (0)