Skip to contentSkip to conversation

Fixes resource leaks for Samsung SoCs

PATCH In review Axel Lin 5 participants 10 messages Nov 26, 2010 – Nov 29, 2010

Subsystems (3)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

cover Fixes resource leaks for Samsung SoCs

This serial of patches fixes resource leaks for Samsung SoCs.

Axel Lin (4):
ASoC: Fix resource leask in goni_wm8994.c
ASoC: Fix resource leask in neo1973_gta02_init() error path
ASoC: Add missing gpio_free(S3C64XX_GPK(12)) in smartq_exit()
ASoC: Fix resource leask in smdk_spdif.c

 sound/soc/samsung/goni_wm8994.c          |    9 +++++++--
 sound/soc/samsung/neo1973_gta02_wm8753.c |   22 +++++++++++-----------
 sound/soc/samsung/smartq_wm8987.c        |    1 +
 sound/soc/samsung/smdk_spdif.c           |   13 +++++++++----
 4 files changed, 28 insertions(+), 17 deletions(-)
Signature · 1 line
1.7.2
author
#1 lore raw

PATCH 1/4 ASoC: Fix resource leask in goni_wm8994.c

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

---
 sound/soc/samsung/goni_wm8994.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
sound/soc/samsung/goni_wm8994.c +7 -2
index dcfac54..cc8528c 100644
@@ -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);
 }
 
Signature · 1 line
1.7.2
#2 lore raw

Re: [PATCH 1/4] ASoC: Fix resource leask in goni_wm8994.c

There is a typo in the subject.

leask -> leak

no?

author
#3 lore raw

PATCH 2/4 ASoC: Fix resource leask in neo1973_gta02_init() error path

In reply to Axel Lin

Properly free allocated resources in neo1973_gta02_init() error path.

---
 sound/soc/samsung/neo1973_gta02_wm8753.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)
sound/soc/samsung/neo1973_gta02_wm8753.c +11 -11
index 8c65b63..3eec610 100644
@@ -439,24 +439,20 @@ static int __init neo1973_gta02_init(void)
 
 	/* register bluetooth DAI here */
 	ret = snd_soc_register_dai(&neo1973_gta02_snd_device->dev, &bt_dai);
-	if (ret) {
-		platform_device_put(neo1973_gta02_snd_device);
-		return ret;
-	}
+	if (ret)
+		goto err_put_device;
 
 	platform_set_drvdata(neo1973_gta02_snd_device, &neo1973_gta02);
 	ret = platform_device_add(neo1973_gta02_snd_device);
 
-	if (ret) {
-		platform_device_put(neo1973_gta02_snd_device);
-		return ret;
-	}
+	if (ret)
+		goto err_unregister_dai;
 
 	/* Initialise GPIOs used by amp */
 	ret = gpio_request(GTA02_GPIO_HP_IN, "GTA02_HP_IN");
 	if (ret) {
 		pr_err("gta02_wm8753: Failed to register GPIO %d\n", GTA02_GPIO_HP_IN);
-		goto err_unregister_device;
+		goto err_del_device;
 	}
 
 	ret = gpio_direction_output(GTA02_GPIO_HP_IN, 1);
@@ -483,8 +479,12 @@ err_free_gpio_amp_shut:
 	gpio_free(GTA02_GPIO_AMP_SHUT);
 err_free_gpio_hp_in:
 	gpio_free(GTA02_GPIO_HP_IN);
-err_unregister_device:
-	platform_device_unregister(neo1973_gta02_snd_device);
+err_del_device:
+	platform_device_del(neo1973_gta02_snd_device);
+err_unregister_dai:
+	snd_soc_unregister_dai(&neo1973_gta02_snd_device->dev);
+err_put_device:
+	platform_device_put(neo1973_gta02_snd_device);
 	return ret;
 }
 module_init(neo1973_gta02_init);
Signature · 1 line
1.7.2
author
#4 lore raw

PATCH 3/4 ASoC: Add missing gpio_free(S3C64XX_GPK(12)) in smartq_exit()

In reply to Axel Lin
---
 sound/soc/samsung/smartq_wm8987.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
sound/soc/samsung/smartq_wm8987.c +1 -0
index 0a46fa8..61e2b52 100644
@@ -274,6 +274,7 @@ err_unregister_device:
 
 static void __exit smartq_exit(void)
 {
+	gpio_free(S3C64XX_GPK(12));
 	snd_soc_jack_free_gpios(&smartq_jack, ARRAY_SIZE(smartq_jack_gpios),
 				smartq_jack_gpios);
 
Signature · 1 line
1.7.2
author
#5 lore raw

PATCH 4/4 ASoC: Fix resource leask in smdk_spdif.c

In reply to Axel Lin

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

---
 sound/soc/samsung/smdk_spdif.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
sound/soc/samsung/smdk_spdif.c +9 -4
index fe43eaf..82d17dc 100644
@@ -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);
Signature · 1 line
1.7.2
Acked-by on the v1 series
#6 lore raw
In reply to Axel Lin
Quoted 8 lines · Axel Lin

This serial of patches fixes resource leaks for Samsung SoCs.

Axel Lin (4):
ASoC: Fix resource leask in goni_wm8994.c
ASoC: Fix resource leask in neo1973_gta02_init() error path
ASoC: Add missing gpio_free(S3C64XX_GPK(12)) in smartq_exit()
ASoC: Fix resource leask in smdk_spdif.c

Quoted 6 lines
 sound/soc/samsung/goni_wm8994.c          |    9 +++++++--
 sound/soc/samsung/neo1973_gta02_wm8753.c |   22 +++++++++++-----------
 sound/soc/samsung/smartq_wm8987.c        |    1 +
 sound/soc/samsung/smdk_spdif.c           |   13 +++++++++----
 4 files changed, 28 insertions(+), 17 deletions(-)

All

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
Acked-by on the v1 series
#8 lore raw
In reply to Axel Lin
Quoted 7 lines · Axel Lin

This serial of patches fixes resource leaks for Samsung SoCs.

Axel Lin (4):
 ASoC: Fix resource leask in goni_wm8994.c
 ASoC: Fix resource leask in neo1973_gta02_init() error path
 ASoC: Add missing gpio_free(S3C64XX_GPK(12)) in smartq_exit()
 ASoC: Fix resource leask in smdk_spdif.c

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#9 lore raw
Quoted 8 lines · Jassi Brar
Quoted 5 lines · Axel Lin

Axel Lin (4):
 ASoC: Fix resource leask in goni_wm8994.c
 ASoC: Fix resource leask in neo1973_gta02_init() error path
 ASoC: Add missing gpio_free(S3C64XX_GPK(12)) in smartq_exit()
 ASoC: Fix resource leask in smdk_spdif.c

All applied now, thanks.