[PATCH v2 2/2] ASoC: stm32: spdifrx: Enable clock before setting substream
phucduc.bui at gmail.com
phucduc.bui at gmail.com
Tue Dec 1 01:43:43 PST 2026
From: bui duc phuc <phucduc.bui at gmail.com>
Enable the clock before assigning the substream to avoid leaving
a stale substream pointer if clock enabling fails.
Signed-off-by: bui duc phuc <phucduc.bui at gmail.com>
---
sound/soc/stm/stm32_spdifrx.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/sound/soc/stm/stm32_spdifrx.c b/sound/soc/stm/stm32_spdifrx.c
index 467c3c583a00..f594634c07c4 100644
--- a/sound/soc/stm/stm32_spdifrx.c
+++ b/sound/soc/stm/stm32_spdifrx.c
@@ -747,14 +747,16 @@ static int stm32_spdifrx_startup(struct snd_pcm_substream *substream,
struct stm32_spdifrx_data *spdifrx = snd_soc_dai_get_drvdata(cpu_dai);
int ret;
+ ret = clk_prepare_enable(spdifrx->kclk);
+ if (ret) {
+ dev_err(&spdifrx->pdev->dev, "Enable kclk failed: %d\n", ret);
+ return ret;
+ }
+
scoped_guard(spinlock_irqsave, &spdifrx->irq_lock)
spdifrx->substream = substream;
- ret = clk_prepare_enable(spdifrx->kclk);
- if (ret)
- dev_err(&spdifrx->pdev->dev, "Enable kclk failed: %d\n", ret);
-
- return ret;
+ return 0;
}
static int stm32_spdifrx_hw_params(struct snd_pcm_substream *substream,
--
2.43.0
More information about the linux-arm-kernel
mailing list