public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] ASoC: fix resource leak in error paths
@ 2010-11-25  7:06 Axel Lin
  2010-11-25  7:07 ` [PATCH 1/8] ASoC: efika-audio-fabric: fix resource leak in efika_fabric_init error path Axel Lin
                   ` (9 more replies)
  0 siblings, 10 replies; 14+ messages in thread
From: Axel Lin @ 2010-11-25  7:06 UTC (permalink / raw)
  To: linux-kernel
  Cc: Liam Girdwood, Mark Brown, alsa-devel, Jon Smirl, Sergey Lapin,
	Sedji Gaouaou, Jaswinder Singh Brar, Mika Westerberg,
	Sascha Hauer

This serial of patches fix resource leak in error paths.

Axel Lin (8):
  ASoC: efika-audio-fabric: fix resource leak in efika_fabric_init
    error path
  ASoC: pcm030-audio-fabric: fix resource leak in pcm030_fabric_init
    error path
  ASoC: snd-soc-afeb9260: remove unneeded platform_device_del in error
    path
  ASoC: sam9g20_wm8731: fix resource leak in at91sam9g20ek_init error
    path
  ASoC: smdk_wm9713: fix resource leak in smdk_init error path
  ASoC: simone: fix resource leak in simone_init error path
  ASoC: imx-ssi: fix resource leak
  ASoC: phycore-ac97: fix resource leak

 sound/soc/atmel/sam9g20_wm8731.c    |    5 ++++-
 sound/soc/atmel/snd-soc-afeb9260.c  |    1 -
 sound/soc/ep93xx/simone.c           |   18 ++++++++++--------
 sound/soc/fsl/efika-audio-fabric.c  |    1 +
 sound/soc/fsl/pcm030-audio-fabric.c |    1 +
 sound/soc/imx/imx-ssi.c             |   15 +++++++++++----
 sound/soc/imx/phycore-ac97.c        |   28 +++++++++++++++++++++-------
 sound/soc/samsung/smdk_wm9713.c     |   17 ++++++++++-------
 8 files changed, 58 insertions(+), 28 deletions(-)

-- 
1.7.2




^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/8] ASoC: efika-audio-fabric: fix resource leak in efika_fabric_init error path
  2010-11-25  7:06 [PATCH 0/8] ASoC: fix resource leak in error paths Axel Lin
@ 2010-11-25  7:07 ` Axel Lin
  2010-11-25  7:08 ` [PATCH 2/8] ASoC: pcm030-audio-fabric: fix resource leak in pcm030_fabric_init " Axel Lin
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Axel Lin @ 2010-11-25  7:07 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jon Smirl, Liam Girdwood, Mark Brown, alsa-devel

Add missing platform_device_put() if platform_device_add() failed.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 sound/soc/fsl/efika-audio-fabric.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/sound/soc/fsl/efika-audio-fabric.c b/sound/soc/fsl/efika-audio-fabric.c
index 53251e6..108b5d8 100644
--- a/sound/soc/fsl/efika-audio-fabric.c
+++ b/sound/soc/fsl/efika-audio-fabric.c
@@ -76,6 +76,7 @@ static __init int efika_fabric_init(void)
 	rc = platform_device_add(pdev);
 	if (rc) {
 		pr_err("efika_fabric_init: platform_device_add() failed\n");
+		platform_device_put(pdev);
 		return -ENODEV;
 	}
 	return 0;
-- 
1.7.2




^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/8] ASoC: pcm030-audio-fabric: fix resource leak in pcm030_fabric_init error path
  2010-11-25  7:06 [PATCH 0/8] ASoC: fix resource leak in error paths Axel Lin
  2010-11-25  7:07 ` [PATCH 1/8] ASoC: efika-audio-fabric: fix resource leak in efika_fabric_init error path Axel Lin
@ 2010-11-25  7:08 ` Axel Lin
  2010-11-25  7:10 ` [PATCH 3/8] ASoC: snd-soc-afeb9260: remove unneeded platform_device_del in " Axel Lin
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Axel Lin @ 2010-11-25  7:08 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jon Smirl, Liam Girdwood, Mark Brown, alsa-devel

Add missing platform_device_put() if platform_device_add() failed.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 sound/soc/fsl/pcm030-audio-fabric.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c
index 25f27ec..ba4d85e 100644
--- a/sound/soc/fsl/pcm030-audio-fabric.c
+++ b/sound/soc/fsl/pcm030-audio-fabric.c
@@ -76,6 +76,7 @@ static __init int pcm030_fabric_init(void)
 	rc = platform_device_add(pdev);
 	if (rc) {
 		pr_err("pcm030_fabric_init: platform_device_add() failed\n");
+		platform_device_put(pdev);
 		return -ENODEV;
 	}
 	return 0;
-- 
1.7.2




^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/8] ASoC: snd-soc-afeb9260: remove unneeded platform_device_del in error path
  2010-11-25  7:06 [PATCH 0/8] ASoC: fix resource leak in error paths Axel Lin
  2010-11-25  7:07 ` [PATCH 1/8] ASoC: efika-audio-fabric: fix resource leak in efika_fabric_init error path Axel Lin
  2010-11-25  7:08 ` [PATCH 2/8] ASoC: pcm030-audio-fabric: fix resource leak in pcm030_fabric_init " Axel Lin
@ 2010-11-25  7:10 ` Axel Lin
  2010-11-25  7:11 ` [PATCH 4/8] ASoC: sam9g20_wm8731: fix resource leak in at91sam9g20ek_init " Axel Lin
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Axel Lin @ 2010-11-25  7:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Sergey Lapin, Liam Girdwood, Mark Brown, alsa-devel

>From f3b1f9a02fe390b2f12b9097a1d4d9de55618b34 Mon Sep 17 00:00:00 2001
From: Axel Lin <axel.lin@gmail.com>
Date: Thu, 25 Nov 2010 10:44:59 +0800
Subject: [PATCH 3/8] ASoC: snd-soc-afeb9260: remove unneeded platform_device_del in error path

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 sound/soc/atmel/snd-soc-afeb9260.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/sound/soc/atmel/snd-soc-afeb9260.c b/sound/soc/atmel/snd-soc-afeb9260.c
index 1202f5e..da2208e 100644
--- a/sound/soc/atmel/snd-soc-afeb9260.c
+++ b/sound/soc/atmel/snd-soc-afeb9260.c
@@ -167,7 +167,6 @@ static int __init afeb9260_soc_init(void)
 
 	return 0;
 err1:
-	platform_device_del(afeb9260_snd_device);
 	platform_device_put(afeb9260_snd_device);
 	return err;
 }
-- 
1.7.2




^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/8] ASoC: sam9g20_wm8731: fix resource leak in at91sam9g20ek_init error path
  2010-11-25  7:06 [PATCH 0/8] ASoC: fix resource leak in error paths Axel Lin
                   ` (2 preceding siblings ...)
  2010-11-25  7:10 ` [PATCH 3/8] ASoC: snd-soc-afeb9260: remove unneeded platform_device_del in " Axel Lin
@ 2010-11-25  7:11 ` Axel Lin
  2010-11-25  7:11 ` [PATCH 5/8] ASoC: smdk_wm9713: fix resource leak in smdk_init " Axel Lin
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Axel Lin @ 2010-11-25  7:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Sedji Gaouaou, Liam Girdwood, Mark Brown, alsa-devel

Fix the error path to properly free allocated resources.

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

diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c
index 1c9de19..af3c730 100644
--- a/sound/soc/atmel/sam9g20_wm8731.c
+++ b/sound/soc/atmel/sam9g20_wm8731.c
@@ -240,6 +240,7 @@ static int __init at91sam9g20ek_init(void)
 	if (!at91sam9g20ek_snd_device) {
 		printk(KERN_ERR "ASoC: Platform device allocation failed\n");
 		ret = -ENOMEM;
+		goto err_mclk;
 	}
 
 	platform_set_drvdata(at91sam9g20ek_snd_device,
@@ -248,11 +249,13 @@ static int __init at91sam9g20ek_init(void)
 	ret = platform_device_add(at91sam9g20ek_snd_device);
 	if (ret) {
 		printk(KERN_ERR "ASoC: Platform device allocation failed\n");
-		platform_device_put(at91sam9g20ek_snd_device);
+		goto err_device_add;
 	}
 
 	return ret;
 
+err_device_add:
+	platform_device_put(at91sam9g20ek_snd_device);
 err_mclk:
 	clk_put(mclk);
 	mclk = NULL;
-- 
1.7.2




^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/8] ASoC: smdk_wm9713: fix resource leak in smdk_init error path
  2010-11-25  7:06 [PATCH 0/8] ASoC: fix resource leak in error paths Axel Lin
                   ` (3 preceding siblings ...)
  2010-11-25  7:11 ` [PATCH 4/8] ASoC: sam9g20_wm8731: fix resource leak in at91sam9g20ek_init " Axel Lin
@ 2010-11-25  7:11 ` Axel Lin
  2010-11-25  7:12 ` [PATCH 6/8] ASoC: simone: fix resource leak in simone_init " Axel Lin
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Axel Lin @ 2010-11-25  7:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jaswinder Singh Brar, Liam Girdwood, Mark Brown, alsa-devel

Fix the error path to properly free allocated resources.

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

diff --git a/sound/soc/samsung/smdk_wm9713.c b/sound/soc/samsung/smdk_wm9713.c
index 7ce2430..238cb3a 100644
--- a/sound/soc/samsung/smdk_wm9713.c
+++ b/sound/soc/samsung/smdk_wm9713.c
@@ -70,24 +70,27 @@ static int __init smdk_init(void)
 
 	ret = platform_device_add(smdk_snd_wm9713_device);
 	if (ret)
-		goto err;
+		goto err1;
 
 	smdk_snd_ac97_device = platform_device_alloc("soc-audio", -1);
 	if (!smdk_snd_ac97_device) {
 		ret = -ENOMEM;
-		goto err;
+		goto err2;
 	}
 
 	platform_set_drvdata(smdk_snd_ac97_device, &smdk);
 
 	ret = platform_device_add(smdk_snd_ac97_device);
-	if (ret) {
-		platform_device_put(smdk_snd_ac97_device);
-		goto err;
-	}
+	if (ret)
+		goto err3;
 
 	return 0;
-err:
+
+err3:
+	platform_device_put(smdk_snd_ac97_device);
+err2:
+	platform_device_del(smdk_snd_wm9713_device);
+err1:
 	platform_device_put(smdk_snd_wm9713_device);
 	return ret;
 }
-- 
1.7.2




^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 6/8] ASoC: simone: fix resource leak in simone_init error path
  2010-11-25  7:06 [PATCH 0/8] ASoC: fix resource leak in error paths Axel Lin
                   ` (4 preceding siblings ...)
  2010-11-25  7:11 ` [PATCH 5/8] ASoC: smdk_wm9713: fix resource leak in smdk_init " Axel Lin
@ 2010-11-25  7:12 ` Axel Lin
  2010-11-25  8:06   ` Mika Westerberg
  2010-11-25  7:13 ` [PATCH 7/8] ASoC: imx-ssi: fix resource leak Axel Lin
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 14+ messages in thread
From: Axel Lin @ 2010-11-25  7:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: Mika Westerberg, Liam Girdwood, Mark Brown, alsa-devel

Fix the error path to properly free allocated resources.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 sound/soc/ep93xx/simone.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/sound/soc/ep93xx/simone.c b/sound/soc/ep93xx/simone.c
index 4b0d199..2868179 100644
--- a/sound/soc/ep93xx/simone.c
+++ b/sound/soc/ep93xx/simone.c
@@ -54,24 +54,26 @@ static int __init simone_init(void)
 
 	ret = platform_device_add(simone_snd_ac97_device);
 	if (ret)
-		goto fail;
+		goto fail1;
 
 	simone_snd_device = platform_device_alloc("soc-audio", -1);
 	if (!simone_snd_device) {
 		ret = -ENOMEM;
-		goto fail;
+		goto fail2;
 	}
 
 	platform_set_drvdata(simone_snd_device, &snd_soc_simone);
 	ret = platform_device_add(simone_snd_device);
-	if (ret) {
-		platform_device_put(simone_snd_device);
-		goto fail;
-	}
+	if (ret)
+		goto fail3;
 
-	return ret;
+	return 0;
 
-fail:
+fail3:
+	platform_device_put(simone_snd_device);
+fail2:
+	platform_device_del(simone_snd_ac97_device);
+fail1:
 	platform_device_put(simone_snd_ac97_device);
 	return ret;
 }
-- 
1.7.2




^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 7/8] ASoC: imx-ssi: fix resource leak
  2010-11-25  7:06 [PATCH 0/8] ASoC: fix resource leak in error paths Axel Lin
                   ` (5 preceding siblings ...)
  2010-11-25  7:12 ` [PATCH 6/8] ASoC: simone: fix resource leak in simone_init " Axel Lin
@ 2010-11-25  7:13 ` Axel Lin
  2010-11-25  9:19   ` Sascha Hauer
  2010-11-25  7:14 ` [PATCH 8/8] ASoC: phycore-ac97: " Axel Lin
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 14+ messages in thread
From: Axel Lin @ 2010-11-25  7:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Sascha Hauer, Liam Girdwood, Mark Brown, alsa-devel

Fix imx_ssi_probe() error path and imx_ssi_remove() to properly free
allocated resources.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 sound/soc/imx/imx-ssi.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c
index ad21f81..30894ea 100644
--- a/sound/soc/imx/imx-ssi.c
+++ b/sound/soc/imx/imx-ssi.c
@@ -679,8 +679,11 @@ static int imx_ssi_probe(struct platform_device *pdev)
 	}
 
 	ssi->soc_platform_pdev_fiq = platform_device_alloc("imx-fiq-pcm-audio", pdev->id);
-	if (!ssi->soc_platform_pdev_fiq)
+	if (!ssi->soc_platform_pdev_fiq) {
+		ret = -ENOMEM;
 		goto failed_pdev_fiq_alloc;
+	}
+
 	platform_set_drvdata(ssi->soc_platform_pdev_fiq, ssi);
 	ret = platform_device_add(ssi->soc_platform_pdev_fiq);
 	if (ret) {
@@ -689,8 +692,11 @@ static int imx_ssi_probe(struct platform_device *pdev)
 	}
 
 	ssi->soc_platform_pdev = platform_device_alloc("imx-pcm-audio", pdev->id);
-	if (!ssi->soc_platform_pdev)
+	if (!ssi->soc_platform_pdev) {
+		ret = -ENOMEM;
 		goto failed_pdev_alloc;
+	}
+
 	platform_set_drvdata(ssi->soc_platform_pdev, ssi);
 	ret = platform_device_add(ssi->soc_platform_pdev);
 	if (ret) {
@@ -703,6 +709,7 @@ static int imx_ssi_probe(struct platform_device *pdev)
 failed_pdev_add:
 	platform_device_put(ssi->soc_platform_pdev);
 failed_pdev_alloc:
+	platform_device_del(ssi->soc_platform_pdev_fiq);
 failed_pdev_fiq_add:
 	platform_device_put(ssi->soc_platform_pdev_fiq);
 failed_pdev_fiq_alloc:
@@ -726,8 +733,8 @@ static int __devexit imx_ssi_remove(struct platform_device *pdev)
 	struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	struct imx_ssi *ssi = platform_get_drvdata(pdev);
 
-	platform_device_del(ssi->soc_platform_pdev);
-	platform_device_put(ssi->soc_platform_pdev);
+	platform_device_unregister(ssi->soc_platform_pdev);
+	platform_device_unregister(ssi->soc_platform_pdev_fiq);
 
 	snd_soc_unregister_dai(&pdev->dev);
 
-- 
1.7.2




^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 8/8] ASoC: phycore-ac97: fix resource leak
  2010-11-25  7:06 [PATCH 0/8] ASoC: fix resource leak in error paths Axel Lin
                   ` (6 preceding siblings ...)
  2010-11-25  7:13 ` [PATCH 7/8] ASoC: imx-ssi: fix resource leak Axel Lin
@ 2010-11-25  7:14 ` Axel Lin
  2010-11-25  9:19   ` Sascha Hauer
  2010-11-25 10:47 ` [PATCH 0/8] ASoC: fix resource leak in error paths Liam Girdwood
  2010-11-25 11:14 ` Mark Brown
  9 siblings, 1 reply; 14+ messages in thread
From: Axel Lin @ 2010-11-25  7:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: Sascha Hauer, Liam Girdwood, Mark Brown, alsa-devel

Fix imx_phycore_init() error path and imx_phycore_exit() to properly free
allocated resources.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 sound/soc/imx/phycore-ac97.c |   28 +++++++++++++++++++++-------
 1 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/sound/soc/imx/phycore-ac97.c b/sound/soc/imx/phycore-ac97.c
index db157f7..a7deb5c 100644
--- a/sound/soc/imx/phycore-ac97.c
+++ b/sound/soc/imx/phycore-ac97.c
@@ -42,6 +42,7 @@ static struct snd_soc_card imx_phycore = {
 	.num_links	= ARRAY_SIZE(imx_phycore_dai_ac97),
 };
 
+static struct platform_device *imx_phycore_snd_ac97_device;
 static struct platform_device *imx_phycore_snd_device;
 
 static int __init imx_phycore_init(void)
@@ -52,29 +53,42 @@ static int __init imx_phycore_init(void)
 		/* return happy. We might run on a totally different machine */
 		return 0;
 
-	imx_phycore_snd_device = platform_device_alloc("soc-audio", -1);
-	if (!imx_phycore_snd_device)
+	imx_phycore_snd_ac97_device = platform_device_alloc("soc-audio", -1);
+	if (!imx_phycore_snd_ac97_device)
 		return -ENOMEM;
 
-	platform_set_drvdata(imx_phycore_snd_device, &imx_phycore);
-	ret = platform_device_add(imx_phycore_snd_device);
+	platform_set_drvdata(imx_phycore_snd_ac97_device, &imx_phycore);
+	ret = platform_device_add(imx_phycore_snd_ac97_device);
+	if (ret)
+		goto fail1;
 
 	imx_phycore_snd_device = platform_device_alloc("wm9712-codec", -1);
-	if (!imx_phycore_snd_device)
-		return -ENOMEM;
+	if (!imx_phycore_snd_device) {
+		ret = -ENOMEM;
+		goto fail2;
+	}
 	ret = platform_device_add(imx_phycore_snd_device);
 
 	if (ret) {
 		printk(KERN_ERR "ASoC: Platform device allocation failed\n");
-		platform_device_put(imx_phycore_snd_device);
+		goto fail3;
 	}
 
+	return 0;
+
+fail3:
+	platform_device_put(imx_phycore_snd_device);
+fail2:
+	platform_device_del(imx_phycore_snd_ac97_device);
+fail1:
+	platform_device_put(imx_phycore_snd_ac97_device);
 	return ret;
 }
 
 static void __exit imx_phycore_exit(void)
 {
 	platform_device_unregister(imx_phycore_snd_device);
+	platform_device_unregister(imx_phycore_snd_ac97_device);
 }
 
 late_initcall(imx_phycore_init);
-- 
1.7.2




^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 6/8] ASoC: simone: fix resource leak in simone_init error path
  2010-11-25  7:12 ` [PATCH 6/8] ASoC: simone: fix resource leak in simone_init " Axel Lin
@ 2010-11-25  8:06   ` Mika Westerberg
  0 siblings, 0 replies; 14+ messages in thread
From: Mika Westerberg @ 2010-11-25  8:06 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Liam Girdwood, Mark Brown, alsa-devel

On Thu, Nov 25, 2010 at 03:12:30PM +0800, Axel Lin wrote:
> Fix the error path to properly free allocated resources.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

Acked-by: Mika Westerberg <mika.westerberg@iki.fi>

Thanks for catching this.

> ---
>  sound/soc/ep93xx/simone.c |   18 ++++++++++--------
>  1 files changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/sound/soc/ep93xx/simone.c b/sound/soc/ep93xx/simone.c
> index 4b0d199..2868179 100644
> --- a/sound/soc/ep93xx/simone.c
> +++ b/sound/soc/ep93xx/simone.c
> @@ -54,24 +54,26 @@ static int __init simone_init(void)
>  
>  	ret = platform_device_add(simone_snd_ac97_device);
>  	if (ret)
> -		goto fail;
> +		goto fail1;
>  
>  	simone_snd_device = platform_device_alloc("soc-audio", -1);
>  	if (!simone_snd_device) {
>  		ret = -ENOMEM;
> -		goto fail;
> +		goto fail2;
>  	}
>  
>  	platform_set_drvdata(simone_snd_device, &snd_soc_simone);
>  	ret = platform_device_add(simone_snd_device);
> -	if (ret) {
> -		platform_device_put(simone_snd_device);
> -		goto fail;
> -	}
> +	if (ret)
> +		goto fail3;
>  
> -	return ret;
> +	return 0;
>  
> -fail:
> +fail3:
> +	platform_device_put(simone_snd_device);
> +fail2:
> +	platform_device_del(simone_snd_ac97_device);
> +fail1:
>  	platform_device_put(simone_snd_ac97_device);
>  	return ret;
>  }
> -- 
> 1.7.2
> 
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 7/8] ASoC: imx-ssi: fix resource leak
  2010-11-25  7:13 ` [PATCH 7/8] ASoC: imx-ssi: fix resource leak Axel Lin
@ 2010-11-25  9:19   ` Sascha Hauer
  0 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2010-11-25  9:19 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Liam Girdwood, Mark Brown, alsa-devel

On Thu, Nov 25, 2010 at 03:13:09PM +0800, Axel Lin wrote:
> Fix imx_ssi_probe() error path and imx_ssi_remove() to properly free
> allocated resources.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

Acked-by: Sascha Hauer <s.hauer@pengutronix.de>

> ---
>  sound/soc/imx/imx-ssi.c |   15 +++++++++++----
>  1 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c
> index ad21f81..30894ea 100644
> --- a/sound/soc/imx/imx-ssi.c
> +++ b/sound/soc/imx/imx-ssi.c
> @@ -679,8 +679,11 @@ static int imx_ssi_probe(struct platform_device *pdev)
>  	}
>  
>  	ssi->soc_platform_pdev_fiq = platform_device_alloc("imx-fiq-pcm-audio", pdev->id);
> -	if (!ssi->soc_platform_pdev_fiq)
> +	if (!ssi->soc_platform_pdev_fiq) {
> +		ret = -ENOMEM;
>  		goto failed_pdev_fiq_alloc;
> +	}
> +
>  	platform_set_drvdata(ssi->soc_platform_pdev_fiq, ssi);
>  	ret = platform_device_add(ssi->soc_platform_pdev_fiq);
>  	if (ret) {
> @@ -689,8 +692,11 @@ static int imx_ssi_probe(struct platform_device *pdev)
>  	}
>  
>  	ssi->soc_platform_pdev = platform_device_alloc("imx-pcm-audio", pdev->id);
> -	if (!ssi->soc_platform_pdev)
> +	if (!ssi->soc_platform_pdev) {
> +		ret = -ENOMEM;
>  		goto failed_pdev_alloc;
> +	}
> +
>  	platform_set_drvdata(ssi->soc_platform_pdev, ssi);
>  	ret = platform_device_add(ssi->soc_platform_pdev);
>  	if (ret) {
> @@ -703,6 +709,7 @@ static int imx_ssi_probe(struct platform_device *pdev)
>  failed_pdev_add:
>  	platform_device_put(ssi->soc_platform_pdev);
>  failed_pdev_alloc:
> +	platform_device_del(ssi->soc_platform_pdev_fiq);
>  failed_pdev_fiq_add:
>  	platform_device_put(ssi->soc_platform_pdev_fiq);
>  failed_pdev_fiq_alloc:
> @@ -726,8 +733,8 @@ static int __devexit imx_ssi_remove(struct platform_device *pdev)
>  	struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	struct imx_ssi *ssi = platform_get_drvdata(pdev);
>  
> -	platform_device_del(ssi->soc_platform_pdev);
> -	platform_device_put(ssi->soc_platform_pdev);
> +	platform_device_unregister(ssi->soc_platform_pdev);
> +	platform_device_unregister(ssi->soc_platform_pdev_fiq);
>  
>  	snd_soc_unregister_dai(&pdev->dev);
>  
> -- 
> 1.7.2
> 
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 8/8] ASoC: phycore-ac97: fix resource leak
  2010-11-25  7:14 ` [PATCH 8/8] ASoC: phycore-ac97: " Axel Lin
@ 2010-11-25  9:19   ` Sascha Hauer
  0 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2010-11-25  9:19 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Liam Girdwood, Mark Brown, alsa-devel

On Thu, Nov 25, 2010 at 03:14:03PM +0800, Axel Lin wrote:
> Fix imx_phycore_init() error path and imx_phycore_exit() to properly free
> allocated resources.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

Acked-by: Sascha Hauer <s.hauer@pengutronix.de>

> ---
>  sound/soc/imx/phycore-ac97.c |   28 +++++++++++++++++++++-------
>  1 files changed, 21 insertions(+), 7 deletions(-)
> 
> diff --git a/sound/soc/imx/phycore-ac97.c b/sound/soc/imx/phycore-ac97.c
> index db157f7..a7deb5c 100644
> --- a/sound/soc/imx/phycore-ac97.c
> +++ b/sound/soc/imx/phycore-ac97.c
> @@ -42,6 +42,7 @@ static struct snd_soc_card imx_phycore = {
>  	.num_links	= ARRAY_SIZE(imx_phycore_dai_ac97),
>  };
>  
> +static struct platform_device *imx_phycore_snd_ac97_device;
>  static struct platform_device *imx_phycore_snd_device;
>  
>  static int __init imx_phycore_init(void)
> @@ -52,29 +53,42 @@ static int __init imx_phycore_init(void)
>  		/* return happy. We might run on a totally different machine */
>  		return 0;
>  
> -	imx_phycore_snd_device = platform_device_alloc("soc-audio", -1);
> -	if (!imx_phycore_snd_device)
> +	imx_phycore_snd_ac97_device = platform_device_alloc("soc-audio", -1);
> +	if (!imx_phycore_snd_ac97_device)
>  		return -ENOMEM;
>  
> -	platform_set_drvdata(imx_phycore_snd_device, &imx_phycore);
> -	ret = platform_device_add(imx_phycore_snd_device);
> +	platform_set_drvdata(imx_phycore_snd_ac97_device, &imx_phycore);
> +	ret = platform_device_add(imx_phycore_snd_ac97_device);
> +	if (ret)
> +		goto fail1;
>  
>  	imx_phycore_snd_device = platform_device_alloc("wm9712-codec", -1);
> -	if (!imx_phycore_snd_device)
> -		return -ENOMEM;
> +	if (!imx_phycore_snd_device) {
> +		ret = -ENOMEM;
> +		goto fail2;
> +	}
>  	ret = platform_device_add(imx_phycore_snd_device);
>  
>  	if (ret) {
>  		printk(KERN_ERR "ASoC: Platform device allocation failed\n");
> -		platform_device_put(imx_phycore_snd_device);
> +		goto fail3;
>  	}
>  
> +	return 0;
> +
> +fail3:
> +	platform_device_put(imx_phycore_snd_device);
> +fail2:
> +	platform_device_del(imx_phycore_snd_ac97_device);
> +fail1:
> +	platform_device_put(imx_phycore_snd_ac97_device);
>  	return ret;
>  }
>  
>  static void __exit imx_phycore_exit(void)
>  {
>  	platform_device_unregister(imx_phycore_snd_device);
> +	platform_device_unregister(imx_phycore_snd_ac97_device);
>  }
>  
>  late_initcall(imx_phycore_init);
> -- 
> 1.7.2
> 
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/8] ASoC: fix resource leak in error paths
  2010-11-25  7:06 [PATCH 0/8] ASoC: fix resource leak in error paths Axel Lin
                   ` (7 preceding siblings ...)
  2010-11-25  7:14 ` [PATCH 8/8] ASoC: phycore-ac97: " Axel Lin
@ 2010-11-25 10:47 ` Liam Girdwood
  2010-11-25 11:14 ` Mark Brown
  9 siblings, 0 replies; 14+ messages in thread
From: Liam Girdwood @ 2010-11-25 10:47 UTC (permalink / raw)
  To: Axel Lin
  Cc: linux-kernel, Mark Brown, alsa-devel, Jon Smirl, Sergey Lapin,
	Sedji Gaouaou, Jaswinder Singh Brar, Mika Westerberg,
	Sascha Hauer

On Thu, 2010-11-25 at 15:06 +0800, Axel Lin wrote:
> This serial of patches fix resource leak in error paths.
> 
> Axel Lin (8):
>   ASoC: efika-audio-fabric: fix resource leak in efika_fabric_init
>     error path
>   ASoC: pcm030-audio-fabric: fix resource leak in pcm030_fabric_init
>     error path
>   ASoC: snd-soc-afeb9260: remove unneeded platform_device_del in error
>     path
>   ASoC: sam9g20_wm8731: fix resource leak in at91sam9g20ek_init error
>     path
>   ASoC: smdk_wm9713: fix resource leak in smdk_init error path
>   ASoC: simone: fix resource leak in simone_init error path
>   ASoC: imx-ssi: fix resource leak
>   ASoC: phycore-ac97: fix resource leak
> 
>  sound/soc/atmel/sam9g20_wm8731.c    |    5 ++++-
>  sound/soc/atmel/snd-soc-afeb9260.c  |    1 -
>  sound/soc/ep93xx/simone.c           |   18 ++++++++++--------
>  sound/soc/fsl/efika-audio-fabric.c  |    1 +
>  sound/soc/fsl/pcm030-audio-fabric.c |    1 +
>  sound/soc/imx/imx-ssi.c             |   15 +++++++++++----
>  sound/soc/imx/phycore-ac97.c        |   28 +++++++++++++++++++++-------
>  sound/soc/samsung/smdk_wm9713.c     |   17 ++++++++++-------
>  8 files changed, 58 insertions(+), 28 deletions(-)
> 
All

Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/8] ASoC: fix resource leak in error paths
  2010-11-25  7:06 [PATCH 0/8] ASoC: fix resource leak in error paths Axel Lin
                   ` (8 preceding siblings ...)
  2010-11-25 10:47 ` [PATCH 0/8] ASoC: fix resource leak in error paths Liam Girdwood
@ 2010-11-25 11:14 ` Mark Brown
  9 siblings, 0 replies; 14+ messages in thread
From: Mark Brown @ 2010-11-25 11:14 UTC (permalink / raw)
  To: Axel Lin
  Cc: linux-kernel, Liam Girdwood, alsa-devel, Jon Smirl, Sergey Lapin,
	Sedji Gaouaou, Jaswinder Singh Brar, Mika Westerberg,
	Sascha Hauer

On Thu, Nov 25, 2010 at 03:06:25PM +0800, Axel Lin wrote:
> This serial of patches fix resource leak in error paths.

All applied, thanks - thanks for taking the time to do so many cleanups
recently, it's appreciated.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2010-11-25 11:14 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-25  7:06 [PATCH 0/8] ASoC: fix resource leak in error paths Axel Lin
2010-11-25  7:07 ` [PATCH 1/8] ASoC: efika-audio-fabric: fix resource leak in efika_fabric_init error path Axel Lin
2010-11-25  7:08 ` [PATCH 2/8] ASoC: pcm030-audio-fabric: fix resource leak in pcm030_fabric_init " Axel Lin
2010-11-25  7:10 ` [PATCH 3/8] ASoC: snd-soc-afeb9260: remove unneeded platform_device_del in " Axel Lin
2010-11-25  7:11 ` [PATCH 4/8] ASoC: sam9g20_wm8731: fix resource leak in at91sam9g20ek_init " Axel Lin
2010-11-25  7:11 ` [PATCH 5/8] ASoC: smdk_wm9713: fix resource leak in smdk_init " Axel Lin
2010-11-25  7:12 ` [PATCH 6/8] ASoC: simone: fix resource leak in simone_init " Axel Lin
2010-11-25  8:06   ` Mika Westerberg
2010-11-25  7:13 ` [PATCH 7/8] ASoC: imx-ssi: fix resource leak Axel Lin
2010-11-25  9:19   ` Sascha Hauer
2010-11-25  7:14 ` [PATCH 8/8] ASoC: phycore-ac97: " Axel Lin
2010-11-25  9:19   ` Sascha Hauer
2010-11-25 10:47 ` [PATCH 0/8] ASoC: fix resource leak in error paths Liam Girdwood
2010-11-25 11:14 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox