Skip to contentSkip to conversation

ASoC: SOF: pcm: Reverse check for prepared stream in sof_pcm_hw_params()

PATCH In review Peter Ujfalusi 2 participants 2 messages Jun 19, 2025 – Jun 20, 2025

Subsystems (3)
lore
Share & tools
lore

Peter Ujfalusi

author maintainer
#0 lore raw

PATCH 1/1 ASoC: SOF: pcm: Reverse check for prepared stream in sof_pcm_hw_params()

Reduce the number of checks needed with the simple and most common audio sequence when the stream is started then stopped.

If the stream has not been prepared there is no need to check if we have pcm_ops and pcm_ops->hw_free() callback as it does not matter.

---
 sound/soc/sof/pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sof/pcm.c +1 -1
index d584a72e6f52..deeb1fd8392a 100644
@@ -144,7 +144,7 @@ static int sof_pcm_hw_params(struct snd_soc_component *component,
 	 * Handle repeated calls to hw_params() without free_pcm() in
 	 * between. At least ALSA OSS emulation depends on this.
 	 */
-	if (pcm_ops && pcm_ops->hw_free && spcm->prepared[substream->stream]) {
+	if (spcm->prepared[substream->stream] && pcm_ops && pcm_ops->hw_free) {
 		ret = pcm_ops->hw_free(component, substream);
 		if (ret < 0)
 			return ret;
Signature · 1 line
2.49.0
maintainer
#1 lore raw
Quoted 8 lines · Peter Ujfalusi

Reduce the number of checks needed with the simple and most common audio sequence when the stream is started then stopped.

If the stream has not been prepared there is no need to check if we have pcm_ops and pcm_ops->hw_free() callback as it does not matter.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: SOF: pcm: Reverse check for prepared stream in sof_pcm_hw_params()

      commit: 3d77763c9a6d94ebc258183583891fdf23599a18

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark