[alsa-devel] [PATCH] ASoC: soc-pcm: make symmetry work again

Russell King rmk+kernel at armlinux.org.uk
Thu Mar 7 14:59:19 CET 2019


Commit 957ce0c6b8a1 ("ASoC: soc-pcm: check symmetry after hw_params")
moved the check for symmetry after we have set the cpu_dai's rate,
channels and sample width to those in the params.

The symmetry check verifies that the cpu dai's stored parameters are
the same as those in the params.  Since we have only just stored these
parameters, this makes the symmetry checks always pass.

Fix this by moving the symmetry check before we store the parameters,
but after the parameters have been fixed up.

Fixes: 957ce0c6b8a1 ("ASoC: soc-pcm: check symmetry after hw_params")
Signed-off-by: Russell King <rmk+kernel at armlinux.org.uk>
---
Not tested: this is something I stumbled over while reading the code.

 sound/soc/soc-pcm.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 08ee163504e8..dc3c3e31d2ef 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1010,15 +1010,16 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
 	}
 	component = NULL;
 
+	ret = soc_pcm_params_symmetry(substream, params);
+        if (ret)
+		goto component_err;
+
 	/* store the parameters for each DAIs */
 	cpu_dai->rate = params_rate(params);
 	cpu_dai->channels = params_channels(params);
 	cpu_dai->sample_bits =
 		snd_pcm_format_physical_width(params_format(params));
 
-	ret = soc_pcm_params_symmetry(substream, params);
-        if (ret)
-		goto component_err;
 out:
 	mutex_unlock(&rtd->pcm_mutex);
 	return ret;
-- 
2.7.4



More information about the Alsa-devel mailing list