ASoC: codecs: wcd934x: handle channel mappping list correctly
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tue, 30 Nov 2021 16:05:04 +0000 (16:05 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Dec 2021 10:32:41 +0000 (11:32 +0100)
commit1089dac26c6b4b833323ae6c0ceab29fb30ede72
tree3d1a7eddbf11de69280ffc2163629306c8135e69
parent83dae68fc00ac9ca52786729d088c2f1f0aa7065
ASoC: codecs: wcd934x: handle channel mappping list correctly

commit 23ba28616d3063bd4c4953598ed5e439ca891101 upstream.

Currently each channel is added as list to dai channel list, however
there is danger of adding same channel to multiple dai channel list
which endups corrupting the other list where its already added.

This patch ensures that the channel is actually free before adding to
the dai channel list and also ensures that the channel is on the list
before deleting it.

This check was missing previously, and we did not hit this issue as
we were testing very simple usecases with sequence of amixer commands.

Fixes: a70d9245759a ("ASoC: wcd934x: add capture dapm widgets")
Fixes: dd9eb19b5673 ("ASoC: wcd934x: add playback dapm widgets")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20211130160507.22180-2-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/soc/codecs/wcd934x.c