From d2314e0e27566f8830ebed3587cc049e07e6a4ee Mon Sep 17 00:00:00 2001 From: Atsushi Nemoto Date: Mon, 16 Mar 2009 23:26:20 +0900 Subject: ASoC: Only deregister AC97 dev if it's name was not "AC97" The commit 14fa43f53ff3a9c3d8b9662574b7369812a31a97 ("ASoC: Only register AC97 bus if it's not done already") added a condition for calling of soc_ac97_dev_register() but not added for calling of soc_ac97_dev_unregister(). This patch adds same condition for soc_ac97_dev_unregister(). Without this fix, kernel crashes when unloading an asoc driver. Signed-off-by: Atsushi Nemoto Signed-off-by: Mark Brown diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 1651832..6e710f7 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1432,7 +1432,8 @@ void snd_soc_free_pcms(struct snd_soc_device *socdev) #ifdef CONFIG_SND_SOC_AC97_BUS for (i = 0; i < codec->num_dai; i++) { codec_dai = &codec->dai[i]; - if (codec_dai->ac97_control && codec->ac97) { + if (codec_dai->ac97_control && codec->ac97 && + strcmp(codec->name, "AC97") != 0) { soc_ac97_dev_unregister(codec); goto free_card; } -- cgit v0.10.2