diff mbox series

ASoC: soc-pcm: make symmetry work again

Message ID E1h1tYN-0004Z9-6M@rmk-PC.armlinux.org.uk (mailing list archive)
State New, archived
Headers show
Series ASoC: soc-pcm: make symmetry work again | expand

Commit Message

Russell King (Oracle) March 7, 2019, 1:59 p.m. UTC
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@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 mbox series

Patch

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;