diff options
author | Axel Lin <axel.lin@gmail.com> | 2010-12-07 16:12:29 +0800 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-12-07 15:27:14 +0000 |
commit | 6b3ed78535c5af8c1d25ed7eaaea7557698843a1 (patch) | |
tree | 7effe0a7676707ab4a76bb65eab971e7836fd925 /sound | |
parent | 0b9a214a606f8c7c7af3e66e7fe0caf3233cfe16 (diff) | |
download | linux-stable-6b3ed78535c5af8c1d25ed7eaaea7557698843a1.tar.gz linux-stable-6b3ed78535c5af8c1d25ed7eaaea7557698843a1.tar.bz2 linux-stable-6b3ed78535c5af8c1d25ed7eaaea7557698843a1.zip |
ASoC: Fix snd_soc_instantiate_card error path
Properly free the resources in the case of snd_card_register failure
and soc_register_ac97_dai_link failure.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/soc-core.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 392d33625327..b4c8c3800503 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1839,18 +1839,20 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card) ret = snd_card_register(card->snd_card); if (ret < 0) { printk(KERN_ERR "asoc: failed to register soundcard for %s\n", card->name); - goto probe_dai_err; + goto probe_aux_dev_err; } #ifdef CONFIG_SND_SOC_AC97_BUS /* register any AC97 codecs */ for (i = 0; i < card->num_rtd; i++) { - ret = soc_register_ac97_dai_link(&card->rtd[i]); - if (ret < 0) { - printk(KERN_ERR "asoc: failed to register AC97 %s\n", card->name); - goto probe_dai_err; - } + ret = soc_register_ac97_dai_link(&card->rtd[i]); + if (ret < 0) { + printk(KERN_ERR "asoc: failed to register AC97 %s\n", card->name); + while (--i >= 0) + soc_unregister_ac97_dai_link(&card->rtd[i]); + goto probe_aux_dev_err; } + } #endif card->instantiated = 1; |