[PATCH 2/2] spi: cadence-quadspi: release DMA channel on probe failure

From: Diogo Ivo (Schneider Electric)

Date: Fri Jul 31 2026 - 07:00:00 EST


When spi_register_controller() fails in cqspi_probe(), the DMA channel
acquired via cqspi_request_mmap_dma() is not released, leaking the channel.
Add a dedicated error label to release the DMA channel before the
existing runtime PM teardown path.

This fix is one part of upstream commit f18c8cfa4f1a ("spi: cadence-qspi:
Fix probe error path and remove").

Fixes: b85815675fc5 ("spi: cadence-quadspi: fix cleanup of rx_chan on failure paths")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Diogo Ivo (Schneider Electric) <diogo.ivo@xxxxxxxxxxx>
---
drivers/spi/spi-cadence-quadspi.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
index d749dee54015..66304664a1cf 100644
--- a/drivers/spi/spi-cadence-quadspi.c
+++ b/drivers/spi/spi-cadence-quadspi.c
@@ -1982,14 +1982,17 @@ static int cqspi_probe(struct platform_device *pdev)
ret = spi_register_controller(host);
if (ret) {
dev_err(&pdev->dev, "failed to register SPI ctlr %d\n", ret);
- goto disable_rpm;
+ goto release_dma_chan;
}

pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);

return 0;
-disable_rpm:
+release_dma_chan:
+ if (cqspi->rx_chan)
+ dma_release_channel(cqspi->rx_chan);
+
pm_runtime_put_noidle(dev);
pm_runtime_dont_use_autosuspend(dev);
pm_runtime_disable(dev);

--
2.55.0