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

spi: stm32-ospi: Fix DMA channel leak on stm32_ospi_dma_setup() failure



When stm32_ospi_dma_setup() fails, the DMA channels allocated by
stm32_ospi_get_resources() were never released. Add proper cleanup
in the error path.

Fixes: e35a7607 ("spi: stm32-ospi: Set DMA maxburst dynamically")
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-stm32-ospi-v1-2-142122466412@gmail.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 5a570c8d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -928,7 +928,7 @@ static int stm32_ospi_probe(struct platform_device *pdev)
	dma_cfg.dst_addr = ospi->regs_phys_base + OSPI_DR;
	ret = stm32_ospi_dma_setup(ospi, &dma_cfg);
	if (ret)
		return ret;
		goto err_dma_free;

	mutex_init(&ospi->lock);

@@ -980,6 +980,7 @@ static int stm32_ospi_probe(struct platform_device *pdev)
err_pm_enable:
	pm_runtime_force_suspend(ospi->dev);
	mutex_destroy(&ospi->lock);
err_dma_free:
	if (ospi->dma_chtx)
		dma_release_channel(ospi->dma_chtx);
	if (ospi->dma_chrx)