[alsa-devel] [PATCH 0/4] 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(-)
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); }
There is a typo in the subject.
leask -> leak
no?
Properly free allocated resources in neo1973_gta02_init() error path.
Signed-off-by: Axel Lin axel.lin@gmail.com --- sound/soc/samsung/neo1973_gta02_wm8753.c | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/sound/soc/samsung/neo1973_gta02_wm8753.c b/sound/soc/samsung/neo1973_gta02_wm8753.c index 8c65b63..3eec610 100644 --- a/sound/soc/samsung/neo1973_gta02_wm8753.c +++ b/sound/soc/samsung/neo1973_gta02_wm8753.c @@ -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);
Signed-off-by: Axel Lin axel.lin@gmail.com --- sound/soc/samsung/smartq_wm8987.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/sound/soc/samsung/smartq_wm8987.c b/sound/soc/samsung/smartq_wm8987.c index 0a46fa8..61e2b52 100644 --- a/sound/soc/samsung/smartq_wm8987.c +++ b/sound/soc/samsung/smartq_wm8987.c @@ -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);
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);
On Fri, 2010-11-26 at 14:50 +0800, Axel Lin wrote:
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(-)
All
Acked-by: Liam Girdwood lrg@slimlogic.co.uk
On Fri, Nov 26, 2010 at 12:26:36PM +0000, Liam Girdwood wrote:
All
Acked-by: Liam Girdwood lrg@slimlogic.co.uk
Jassi, I guess you're OK with these?
On Fri, Nov 26, 2010 at 3:50 PM, Axel Lin axel.lin@gmail.com wrote:
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
Acked-by: Jassi Brar jassi.brar@samsung.com
On Mon, Nov 29, 2010 at 08:40:29AM +0900, Jassi Brar wrote:
On Fri, Nov 26, 2010 at 3:50 PM, Axel Lin axel.lin@gmail.com wrote:
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
Acked-by: Jassi Brar jassi.brar@samsung.com
All applied now, thanks.
participants (5)
-
Axel Lin
-
Jassi Brar
-
Liam Girdwood
-
Mark Brown
-
Thiago Farina