* [PATCH v2] ASoC: stm32: spdifrx: keep the control DMA channel on config failure
@ 2026-11-06 3:54 Wentao Liang
2026-11-06 7:07 ` Krzysztof Kozlowski
0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-11-06 3:54 UTC (permalink / raw)
To: Olivier Moysan, Arnaud Pouliquen, Liam Girdwood, Mark Brown,
Jaroslav Kysela, Takashi Iwai, Maxime Coquelin, Alexandre Torgue
Cc: linux-sound, linux-stm32, linux-arm-kernel
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: 98c8dc2fd59f ("ASoC: stm32: spdifrx: fix control DMA error management")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
Changes in v2:
- Point the Fixes tag at 98c8dc2fd59f ("ASoC: stm32: spdifrx: fix
control DMA error management") rather than at 03e4d5d56fa5
("ASoC: stm32: Add SPDIFRX support"). 03e4d5d56fa5 released the
channel inside stm32_spdifrx_dma_ctrl_register() before clearing
ctrl_chan; 98c8dc2fd59f dropped that release and left the cleanup to
the probe error path, which is where the channel leak on
dmaengine_slave_config() failure was introduced. Noticed by Olivier
Moysan.
- Link to v1: https://lore.kernel.org/all/20261104024051.1508703-1-vulab@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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v2] ASoC: stm32: spdifrx: keep the control DMA channel on config failure
2026-11-06 3:54 [PATCH v2] ASoC: stm32: spdifrx: keep the control DMA channel on config failure Wentao Liang
@ 2026-11-06 7:07 ` Krzysztof Kozlowski
0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-06 7:07 UTC (permalink / raw)
To: Wentao Liang, Olivier Moysan, Arnaud Pouliquen, Liam Girdwood,
Mark Brown, Jaroslav Kysela, Takashi Iwai, Maxime Coquelin,
Alexandre Torgue
Cc: linux-sound, linux-stm32, linux-arm-kernel
On 06/11/2026 04:54, Wentao Liang wrote:
> 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: 98c8dc2fd59f ("ASoC: stm32: spdifrx: fix control DMA error management")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
You still do not bother to run checkpatch, even though I pointed this
many times.
You truly cannot show more how much you ignore people's comments. The
reply to me with "apologize" was a joke, right?
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-06 7:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-06 3:54 [PATCH v2] ASoC: stm32: spdifrx: keep the control DMA channel on config failure Wentao Liang
2026-11-06 7:07 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox