mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 12:13:51 -04:00
spi: spacemit: fix dangling TX DMA descriptor on RX prep failure
In k1_spi_dma_one(), the TX DMA descriptor is submitted via
dmaengine_submit() before the RX descriptor is prepared. If
k1_spi_dma_prep() fails for RX, the function jumps to the fallback
path without terminating the already-submitted TX descriptor.
So terminate the TX channel with dmaengine_terminate_sync() when RX
descriptor preparation fails.
Fixes: efcd8b9d11 ("spi: spacemit: introduce SpacemiT K1 SPI controller driver")
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
Link: https://patch.msgid.link/b402223ebff226782afd4c7da7db4ce34807f604.1784527556.git.xiaopei01@kylinos.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
@@ -289,8 +289,10 @@ static int k1_spi_dma_one(struct spi_controller *host, struct spi_device *spi,
|
||||
|
||||
/* Prepare the RX descriptor and submit it */
|
||||
desc = k1_spi_dma_prep(drv_data, transfer, false);
|
||||
if (!desc)
|
||||
if (!desc) {
|
||||
dmaengine_terminate_sync(host->dma_tx);
|
||||
goto fallback;
|
||||
}
|
||||
|
||||
/* When RX is complete we also know TX has completed */
|
||||
desc->callback = k1_spi_dma_callback;
|
||||
|
||||
Reference in New Issue
Block a user