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>
This commit is contained in:
Axel Lin 2010-12-07 20:56:30 +08:00 committed by Mark Brown
parent 1dcb4f38e5
commit 681e369247

View File

@ -1622,6 +1622,8 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card)
ret = soc_register_ac97_dai_link(&card->rtd[i]); ret = soc_register_ac97_dai_link(&card->rtd[i]);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "asoc: failed to register AC97 %s\n", card->name); 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_dai_err; goto probe_dai_err;
} }
} }