aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2010-12-07 03:12:29 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-12-07 10:27:14 -0500
commit6b3ed78535c5af8c1d25ed7eaaea7557698843a1 (patch)
tree7effe0a7676707ab4a76bb65eab971e7836fd925 /sound/soc/soc-core.c
parent0b9a214a606f8c7c7af3e66e7fe0caf3233cfe16 (diff)
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/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c14
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)
1839 ret = snd_card_register(card->snd_card); 1839 ret = snd_card_register(card->snd_card);
1840 if (ret < 0) { 1840 if (ret < 0) {
1841 printk(KERN_ERR "asoc: failed to register soundcard for %s\n", card->name); 1841 printk(KERN_ERR "asoc: failed to register soundcard for %s\n", card->name);
1842 goto probe_dai_err; 1842 goto probe_aux_dev_err;
1843 } 1843 }
1844 1844
1845#ifdef CONFIG_SND_SOC_AC97_BUS 1845#ifdef CONFIG_SND_SOC_AC97_BUS
1846 /* register any AC97 codecs */ 1846 /* register any AC97 codecs */
1847 for (i = 0; i < card->num_rtd; i++) { 1847 for (i = 0; i < card->num_rtd; i++) {
1848 ret = soc_register_ac97_dai_link(&card->rtd[i]); 1848 ret = soc_register_ac97_dai_link(&card->rtd[i]);
1849 if (ret < 0) { 1849 if (ret < 0) {
1850 printk(KERN_ERR "asoc: failed to register AC97 %s\n", card->name); 1850 printk(KERN_ERR "asoc: failed to register AC97 %s\n", card->name);
1851 goto probe_dai_err; 1851 while (--i >= 0)
1852 } 1852 soc_unregister_ac97_dai_link(&card->rtd[i]);
1853 goto probe_aux_dev_err;
1853 } 1854 }
1855 }
1854#endif 1856#endif
1855 1857
1856 card->instantiated = 1; 1858 card->instantiated = 1;