All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ASoC: soc-pcm: make symmetry work again
@ 2019-03-07 14:01 Russell King
  0 siblings, 0 replies; only message in thread
From: Russell King @ 2019-03-07 14:01 UTC (permalink / raw)
  To: Mark Brown; +Cc: jiada wang, alsa-devel, Takashi Iwai, Liam Girdwood

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.
v2: also fixes the incorrect whitespace indentation copied from the
    original patch.

 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..2a4246dbe55f 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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-03-07 14:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-07 14:01 [PATCH v2] ASoC: soc-pcm: make symmetry work again Russell King

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.