From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
alsa-devel@alsa-project.org
Subject: [PATCH] ASoC: Fix snd_soc_instantiate_card error path
Date: Tue, 07 Dec 2010 17:06:02 +0800 [thread overview]
Message-ID: <1291712762.4776.11.camel@mola> (raw)
>From 0443551476ee6fabe45a0fbc7460dca8e0f6a965 Mon Sep 17 00:00:00 2001
From: Axel Lin <axel.lin@gmail.com>
Date: Tue, 7 Dec 2010 16:12:29 +0800
Subject: [PATCH] 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>
---
This patch is against linux-next tree.
In the case of soc_register_ac97_dai_link failure,
I think we need below fix for Linus's tree:
Add
while (--i >= 0)
soc_unregister_ac97_dai_link(&card->rtd[i]);
just before goto probe_dai_err;
Should I also send a patch against Linus's tree?
Regards,
Axel
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 392d336..b4c8c38 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;
--
1.7.2
next reply other threads:[~2010-12-07 8:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-07 9:06 Axel Lin [this message]
2010-12-07 12:38 ` [PATCH] ASoC: Fix snd_soc_instantiate_card error path Liam Girdwood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1291712762.4776.11.camel@mola \
--to=axel.lin@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@slimlogic.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox