OSDN Git Service

ASoC: soc-pcm: fix state tracking error in snd_soc_component_open/close()
authorKai Vehmanen <kai.vehmanen@linux.intel.com>
Thu, 20 Feb 2020 09:49:55 +0000 (11:49 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 24 Feb 2020 21:48:24 +0000 (21:48 +0000)
commitd2aaa8d8bfba93237ac944ee058fb98e2c2ef983
tree0f19bcd8993bf9c7fda39692ffe0edb3eba24ac4
parent1640c8df0bbac9e5156132e24c0f0a932c2b2865
ASoC: soc-pcm: fix state tracking error in snd_soc_component_open/close()

ASoC component open/close and snd_soc_component_module_get/put are called
independently for each component-substream pair, so the logic added in
commit dd03907bf129 ("ASoC: soc-pcm: call snd_soc_component_open/close()
once") was not sufficient and led to PCM playback and module unload errors.

Implement handling of failures directly in soc_pcm_components_open(),
so that any successfully opened components are closed upon error with
other components. This allows to clean up error handling in
soc_pcm_open() without adding more state tracking.

Fixes: dd03907bf129 ("ASoC: soc-pcm: call snd_soc_component_open/close() once")
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20200220094955.16968-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-component.h
sound/soc/soc-component.c
sound/soc/soc-pcm.c