aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2010-12-07 07:56:30 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-12-07 09:51:15 -0500
commit681e36924788aeea2717c07cc42a21c9c86d7559 (patch)
treeb896db25da65d4185771b2686e9a215da3af07a1 /sound
parent1dcb4f38e5bc28dfce0f8c7eef184a090b03bfc7 (diff)
ASoC: Fix resource leak if soc_register_ac97_dai_link failed
Properly free the resources in the case of soc_register_ac97_dai_link failure. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/soc-core.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 02ae7bea3b50..85b7d548f167 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1619,12 +1619,14 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card)
1619#ifdef CONFIG_SND_SOC_AC97_BUS 1619#ifdef CONFIG_SND_SOC_AC97_BUS
1620 /* register any AC97 codecs */ 1620 /* register any AC97 codecs */
1621 for (i = 0; i < card->num_rtd; i++) { 1621 for (i = 0; i < card->num_rtd; i++) {
1622 ret = soc_register_ac97_dai_link(&card->rtd[i]); 1622 ret = soc_register_ac97_dai_link(&card->rtd[i]);
1623 if (ret < 0) { 1623 if (ret < 0) {
1624 printk(KERN_ERR "asoc: failed to register AC97 %s\n", card->name); 1624 printk(KERN_ERR "asoc: failed to register AC97 %s\n", card->name);
1625 goto probe_dai_err; 1625 while (--i >= 0)
1626 } 1626 soc_unregister_ac97_dai_link(&card->rtd[i]);
1627 goto probe_dai_err;
1627 } 1628 }
1629 }
1628#endif 1630#endif
1629 1631
1630 card->instantiated = 1; 1632 card->instantiated = 1;