summaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2017-04-03 06:31:22 +0000
committerMark Brown <broonie@kernel.org>2017-04-05 18:24:07 +0100
commitc12c1aad98bb75b435e79c6208b56d2018b42f8b (patch)
tree62a1d6f3b6ebc7fecab4fb59ebd7d16f0669d0f9 /sound/soc
parenta5de5b74a50113564a1e0850e2da96c37c35e55d (diff)
downloadlinux-stable-c12c1aad98bb75b435e79c6208b56d2018b42f8b.tar.gz
linux-stable-c12c1aad98bb75b435e79c6208b56d2018b42f8b.tar.bz2
linux-stable-c12c1aad98bb75b435e79c6208b56d2018b42f8b.zip
ASoC: soc-core: verify Sound Card normality
Current ALSA SoC Sound Card basically consists of CPU/Codec/Platform components. If system uses Kernel modules, we can disable these drivers by using rmmod command. In such case, we can't disable CPU/Codec/Platform driver without disabling Sound Card driver. But on the other hand, we can disable these drivers by using unbind command. In such case, we can disable these drivers randomly. In this case, we can create dirty Sound Card which is missing necessary components. (1) If user disabled Sound Card first, but did nothing to other drivers, user can't use Sound because Sound Card is no longer exists. (2) If user disabled CPU/Codec/Platform driver randomly, but did nothing to Sound Card, user still be able to use Sound Card, because dirty Sound Card still exists. In this case, Sound system will be crashed if user started sound playback/capture. But we can't block such random unbind now. To avoid Sound Card crash in (2) case, we need to unregister Sound Card whenever CPU/Codec/Platform component were unregistered. This patch solves this issue. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/soc-core.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index f1901bb1466e..de6d5609c252 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3076,6 +3076,11 @@ static void snd_soc_component_cleanup(struct snd_soc_component *component)
static void snd_soc_component_del_unlocked(struct snd_soc_component *component)
{
+ struct snd_soc_card *card = component->card;
+
+ if (card)
+ snd_soc_unregister_card(card);
+
list_del(&component->list);
}