]> git.baikalelectronics.ru Git - kernel.git/commit
ASoC: soc-pcm: fix regression in soc_new_pcm()
authorStephan Gerhold <stephan@gerhold.net>
Tue, 18 Feb 2020 10:38:24 +0000 (11:38 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 18 Feb 2020 20:58:42 +0000 (20:58 +0000)
commit9cfa55349113db242cc7f85b28a4f2716503c84a
treef12cdedafcd9ab658e922769612adf3adb74afe3
parent3156436e8b268bf96678261d5c40b93f7b122664
ASoC: soc-pcm: fix regression in soc_new_pcm()

Commit 480ca48c8773 ("ASoC: soc-pcm: crash in snd_soc_dapm_new_dai")
swapped the SNDRV_PCM_STREAM_* parameter in the
snd_soc_dai_stream_valid(cpu_dai, ...) checks. But that works only
for codec2codec links. For normal links it breaks registration of
playback/capture-only PCM devices.

E.g. on qcom/apq8016_sbc there is usually one playback-only and one
capture-only PCM device, but they disappeared after the commit.

The codec2codec case was added in commit 435fcd3bd25d
("ASoC: create pcm for codec2codec links as well") as an extra check
(e.g. `playback = playback && cpu_playback->channels_min`).

We should be able to simplify the code by checking directly for
the correct stream type in the loop.
This also fixes the regression because we check for PLAYBACK for
both codec and cpu dai again when codec2codec is not used.

Fixes: 480ca48c8773 ("ASoC: soc-pcm: crash in snd_soc_dapm_new_dai")
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Tested-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
Cc: Jerome Brunet <jbrunet@baylibre.com>
Cc: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/20200218103824.26708-1-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-pcm.c