[PATCH] spi: ingenic: release tx DMA channel when rx request fails
From: Felix Gu
Date: Thu Sep 03 2026 - 14:37:17 EST
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@xxxxxxxxx>
---
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@xxxxxxxxx>