Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6b3ed785 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown
Browse files

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: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 0b9a214a
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -1839,7 +1839,7 @@ 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
@@ -1848,7 +1848,9 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card)
		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;
			while (--i >= 0)
				soc_unregister_ac97_dai_link(&card->rtd[i]);
			goto probe_aux_dev_err;
		}
	}
#endif