[PATCH] spi: ingenic: release tx DMA channel when rx request fails

Felix Gu posted 1 patch 3 weeks, 1 day ago
drivers/spi/spi-ingenic.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
[PATCH] spi: ingenic: release tx DMA channel when rx request fails
Posted by Felix Gu 3 weeks, 1 day ago
When the rx channel request fails, the driver carries on without DMA
but the tx channel it already acquired stayed claimed until devm
teardown.

Release it on the error path so it goes straight back to the DMA
engine for other users.

Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
 drivers/spi/spi-ingenic.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-ingenic.c b/drivers/spi/spi-ingenic.c
index adcf85bccbcc..7ce4fe965cac 100644
--- a/drivers/spi/spi-ingenic.c
+++ b/drivers/spi/spi-ingenic.c
@@ -354,8 +354,11 @@ static int spi_ingenic_request_dma(struct spi_controller *ctlr,
 	ctlr->dma_tx = chan;
 
 	chan = dma_request_chan(dev, "rx");
-	if (IS_ERR(chan))
+	if (IS_ERR(chan)) {
+		dma_release_channel(ctlr->dma_tx);
+		ctlr->dma_tx = NULL;
 		return PTR_ERR(chan);
+	}
 	ctlr->dma_rx = chan;
 
 	ctlr->can_dma = spi_ingenic_can_dma;

---
base-commit: 89c07d98716a13454ec3fd9f97689e812cc71bd4
change-id: 20260904-ingenic-856fb6004802

Best regards,
--  
Felix Gu <ustc.gu@gmail.com>
Re: [PATCH] spi: ingenic: release tx DMA channel when rx request fails
Posted by Mark Brown 3 weeks ago
On Fri, 04 Sep 2026 01:17:33 +0800, Felix Gu wrote:
> spi: ingenic: release tx DMA channel when rx request fails

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.4

Thanks!

[1/1] spi: ingenic: release tx DMA channel when rx request fails
      https://git.kernel.org/broonie/spi/c/bb308b27016c

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