All of lore.kernel.org
 help / color / mirror / Atom feed
From: phucduc.bui@gmail.com
To: Mark Brown <broonie@kernel.org>,
	Olivier Moysan <olivier.moysan@foss.st.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	linux-sound@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	bui duc phuc <phucduc.bui@gmail.com>
Subject: [PATCH v2 2/2] ASoC: stm32: spdifrx: Enable clock before setting substream
Date: Tue,  1 Dec 2026 16:43:43 +0700	[thread overview]
Message-ID: <20261201094343.26675-3-phucduc.bui@gmail.com> (raw)
In-Reply-To: <20261201094343.26675-1-phucduc.bui@gmail.com>

From: bui duc phuc <phucduc.bui@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@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


  parent reply	other threads:[~2026-12-01  9:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  9:43 [PATCH v2 0/2] ASoC: stm32: spdifrx: Fix resource handling and startup phucduc.bui
2026-12-01  9:43 ` [PATCH v2 1/2] ASoC: stm32: spdifrx: Use devm helpers and drop remove callback phucduc.bui
2026-12-01  9:43 ` phucduc.bui [this message]
2026-12-01  9:50   ` [PATCH v2 2/2] ASoC: stm32: spdifrx: Enable clock before setting substream sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261201094343.26675-3-phucduc.bui@gmail.com \
    --to=phucduc.bui@gmail.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=arnaud.pouliquen@foss.st.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=olivier.moysan@foss.st.com \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.