public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Chanwoo Choi <cw00.choi@samsung.com>,
	Jassi Brar <jassi.brar@samsung.com>,
	Liam Girdwood <lrg@slimlogic.co.uk>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	alsa-devel@alsa-project.org
Subject: [PATCH 1/4] ASoC: Fix resource leask in goni_wm8994.c
Date: Fri, 26 Nov 2010 14:51:56 +0800	[thread overview]
Message-ID: <1290754316.25125.2.camel@mola> (raw)
In-Reply-To: <1290754245.25125.1.camel@mola>

Properly free allocated resources in goni_init() error path.
Add missing snd_soc_unregister_dai() in goni_exit().

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 sound/soc/samsung/goni_wm8994.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/sound/soc/samsung/goni_wm8994.c b/sound/soc/samsung/goni_wm8994.c
index dcfac54..cc8528c 100644
--- a/sound/soc/samsung/goni_wm8994.c
+++ b/sound/soc/samsung/goni_wm8994.c
@@ -283,20 +283,25 @@ static int __init goni_init(void)
 
 	/* register voice DAI here */
 	ret = snd_soc_register_dai(&goni_snd_device->dev, &voice_dai);
-	if (ret)
+	if (ret) {
+		platform_device_put(goni_snd_device);
 		return ret;
+	}
 
 	platform_set_drvdata(goni_snd_device, &goni);
 	ret = platform_device_add(goni_snd_device);
 
-	if (ret)
+	if (ret) {
+		snd_soc_unregister_dai(&goni_snd_device->dev);
 		platform_device_put(goni_snd_device);
+	}
 
 	return ret;
 }
 
 static void __exit goni_exit(void)
 {
+	snd_soc_unregister_dai(&goni_snd_device->dev);
 	platform_device_unregister(goni_snd_device);
 }
 
-- 
1.7.2




  reply	other threads:[~2010-11-26  6:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-26  6:50 [PATCH 0/4] Fixes resource leaks for Samsung SoCs Axel Lin
2010-11-26  6:51 ` Axel Lin [this message]
2010-11-29  0:24   ` [PATCH 1/4] ASoC: Fix resource leask in goni_wm8994.c Thiago Farina
2010-11-26  6:52 ` [PATCH 2/4] ASoC: Fix resource leask in neo1973_gta02_init() error path Axel Lin
2010-11-26  6:53 ` [PATCH 3/4] ASoC: Add missing gpio_free(S3C64XX_GPK(12)) in smartq_exit() Axel Lin
2010-11-26  6:54 ` [PATCH 4/4] ASoC: Fix resource leask in smdk_spdif.c Axel Lin
2010-11-26 12:26 ` [PATCH 0/4] Fixes resource leaks for Samsung SoCs Liam Girdwood
2010-11-28 11:02   ` Mark Brown
2010-11-28 23:40 ` [alsa-devel] " Jassi Brar
2010-11-29 11:01   ` Mark Brown

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=1290754316.25125.2.camel@mola \
    --to=axel.lin@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=cw00.choi@samsung.com \
    --cc=jassi.brar@samsung.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