[PATCH] ASoC: stm32: spdifrx: keep the control DMA channel on config failure

Wentao Liang vulab at iscas.ac.cn
Tue Nov 3 18:40:51 PST 2026


When dmaengine_slave_config() fails, stm32_spdifrx_dma_ctrl_register()
sets ctrl_chan to NULL and returns the error. The channel obtained from
dma_request_chan() is thus lost, and stm32_spdifrx_probe() calls
stm32_spdifrx_remove() on the error path, which then passes NULL to
dma_release_channel().

Leave ctrl_chan untouched so that the remove path releases the channel.
Its IS_ERR() check already handles the case where dma_request_chan()
failed.

Fixes: 03e4d5d56fa5 ("ASoC: stm32: Add SPDIFRX support")
Cc: stable at vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab at iscas.ac.cn>
---
 sound/soc/stm/stm32_spdifrx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/soc/stm/stm32_spdifrx.c b/sound/soc/stm/stm32_spdifrx.c
index 88863dbd05d9..ce75929daf73 100644
--- a/sound/soc/stm/stm32_spdifrx.c
+++ b/sound/soc/stm/stm32_spdifrx.c
@@ -425,10 +425,8 @@ static int stm32_spdifrx_dma_ctrl_register(struct device *dev,
 
 	ret = dmaengine_slave_config(spdifrx->ctrl_chan,
 				     &spdifrx->slave_config);
-	if (ret < 0) {
+	if (ret < 0)
 		dev_err(dev, "dmaengine_slave_config returned error %d\n", ret);
-		spdifrx->ctrl_chan = NULL;
-	}
 
 	return ret;
 };
-- 
2.34.1




More information about the linux-arm-kernel mailing list