drivers/spi/spi-stm32.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Avoid trying to release the RX DMA channel when an error occurs
during RX dma_request_chan() call. Instead, jump directly to
release the TX channel, if applicable.
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/linux-spi/aYXvY6NH7OlZ-OAF@stanley.mountain/T/#u
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
---
drivers/spi/spi-stm32.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index b99de8c4cc99..c9442326782c 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -2502,7 +2502,7 @@ static int stm32_spi_probe(struct platform_device *pdev)
spi->dma_rx = NULL;
} else {
dev_err_probe(&pdev->dev, ret, "failed to request rx dma channel\n");
- goto err_dma_release;
+ goto err_dma_tx_release;
}
} else {
ctrl->dma_rx = spi->dma_rx;
@@ -2571,11 +2571,11 @@ static int stm32_spi_probe(struct platform_device *pdev)
if (spi->sram_pool)
gen_pool_free(spi->sram_pool, (unsigned long)spi->sram_rx_buf,
spi->sram_rx_buf_size);
-err_dma_release:
- if (spi->dma_tx)
- dma_release_channel(spi->dma_tx);
if (spi->dma_rx)
dma_release_channel(spi->dma_rx);
+err_dma_tx_release:
+ if (spi->dma_tx)
+ dma_release_channel(spi->dma_tx);
err_clk_disable:
clk_disable_unprepare(spi->clk);
---
base-commit: f921571df917408594a9039ed450859f3bf9cc2e
change-id: 20260211-spi-stm32-fix-dma-rx-release-4bbbfdece8ad
Best regards,
--
Alain Volmat <alain.volmat@foss.st.com>
On Thu, 12 Feb 2026 12:49:10 +0100, Alain Volmat wrote:
> Avoid trying to release the RX DMA channel when an error occurs
> during RX dma_request_chan() call. Instead, jump directly to
> release the TX channel, if applicable.
>
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/1] spi: stm32: fix rx DMA request error handling
commit: 837f6691d5f39ea6453e4489dded40fb17755c60
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
On 2/12/26 12:49, Alain Volmat wrote:
> Avoid trying to release the RX DMA channel when an error occurs
> during RX dma_request_chan() call. Instead, jump directly to
> release the TX channel, if applicable.
>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/linux-spi/aYXvY6NH7OlZ-OAF@stanley.mountain/T/#u
> Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Thank you, Dan, for reporting the issue, and Alain for providing the patch.
Regards,
Amelie
> ---
> drivers/spi/spi-stm32.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
> index b99de8c4cc99..c9442326782c 100644
> --- a/drivers/spi/spi-stm32.c
> +++ b/drivers/spi/spi-stm32.c
> @@ -2502,7 +2502,7 @@ static int stm32_spi_probe(struct platform_device *pdev)
> spi->dma_rx = NULL;
> } else {
> dev_err_probe(&pdev->dev, ret, "failed to request rx dma channel\n");
> - goto err_dma_release;
> + goto err_dma_tx_release;
> }
> } else {
> ctrl->dma_rx = spi->dma_rx;
> @@ -2571,11 +2571,11 @@ static int stm32_spi_probe(struct platform_device *pdev)
> if (spi->sram_pool)
> gen_pool_free(spi->sram_pool, (unsigned long)spi->sram_rx_buf,
> spi->sram_rx_buf_size);
> -err_dma_release:
> - if (spi->dma_tx)
> - dma_release_channel(spi->dma_tx);
> if (spi->dma_rx)
> dma_release_channel(spi->dma_rx);
> +err_dma_tx_release:
> + if (spi->dma_tx)
> + dma_release_channel(spi->dma_tx);
> err_clk_disable:
> clk_disable_unprepare(spi->clk);
>
>
> ---
> base-commit: f921571df917408594a9039ed450859f3bf9cc2e
> change-id: 20260211-spi-stm32-fix-dma-rx-release-4bbbfdece8ad
>
> Best regards,
© 2016 - 2026 Red Hat, Inc.