All of lore.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Seungwhan Youn <sw.youn@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 4/4] ASoC: Fix resource leask in smdk_spdif.c
Date: Fri, 26 Nov 2010 14:54:42 +0800	[thread overview]
Message-ID: <1290754482.25125.9.camel@mola> (raw)
In-Reply-To: <1290754245.25125.1.camel@mola>

Properly free allocated resources in smdk_init() error path.
Add missing platform_device_unregister() in smdk_exit().

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

diff --git a/sound/soc/samsung/smdk_spdif.c b/sound/soc/samsung/smdk_spdif.c
index fe43eaf..82d17dc 100644
--- a/sound/soc/samsung/smdk_spdif.c
+++ b/sound/soc/samsung/smdk_spdif.c
@@ -183,7 +183,7 @@ static int __init smdk_init(void)
 
 	ret = platform_device_add(smdk_snd_spdif_dit_device);
 	if (ret)
-		goto err2;
+		goto err1;
 
 	smdk_snd_spdif_device = platform_device_alloc("soc-audio", -1);
 	if (!smdk_snd_spdif_device) {
@@ -195,17 +195,21 @@ static int __init smdk_init(void)
 
 	ret = platform_device_add(smdk_snd_spdif_device);
 	if (ret)
-		goto err1;
+		goto err3;
 
 	/* Set audio clock hierarchy manually */
 	ret = set_audio_clock_heirachy(smdk_snd_spdif_device);
 	if (ret)
-		goto err1;
+		goto err4;
 
 	return 0;
-err1:
+err4:
+	platform_device_del(smdk_snd_spdif_device);
+err3:
 	platform_device_put(smdk_snd_spdif_device);
 err2:
+	platform_device_del(smdk_snd_spdif_dit_device);
+err1:
 	platform_device_put(smdk_snd_spdif_dit_device);
 	return ret;
 }
@@ -213,6 +217,7 @@ err2:
 static void __exit smdk_exit(void)
 {
 	platform_device_unregister(smdk_snd_spdif_device);
+	platform_device_unregister(smdk_snd_spdif_dit_device);
 }
 
 module_init(smdk_init);
-- 
1.7.2

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

Thread overview: 12+ 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 ` [PATCH 1/4] ASoC: Fix resource leask in goni_wm8994.c Axel Lin
2010-11-29  0:24   ` 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 ` Axel Lin [this message]
2010-11-26 12:26 ` [PATCH 0/4] Fixes resource leaks for Samsung SoCs Liam Girdwood
2010-11-26 12:26   ` Liam Girdwood
2010-11-28 11:02   ` Mark Brown
2010-11-28 23:40 ` Jassi Brar
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=1290754482.25125.9.camel@mola \
    --to=axel.lin@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=jassi.brar@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=sw.youn@samsung.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.