Commit d482337e authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

ASoC: Fix resource leak in smdk_spdif.c

Properly free allocated resources in smdk_init() error path.
Add missing platform_device_unregister() in smdk_exit().
Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Acked-by: default avatarJassi Brar <jassi.brar@samsung.com>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 3790f205
...@@ -183,7 +183,7 @@ static int __init smdk_init(void) ...@@ -183,7 +183,7 @@ static int __init smdk_init(void)
ret = platform_device_add(smdk_snd_spdif_dit_device); ret = platform_device_add(smdk_snd_spdif_dit_device);
if (ret) if (ret)
goto err2; goto err1;
smdk_snd_spdif_device = platform_device_alloc("soc-audio", -1); smdk_snd_spdif_device = platform_device_alloc("soc-audio", -1);
if (!smdk_snd_spdif_device) { if (!smdk_snd_spdif_device) {
...@@ -195,17 +195,21 @@ static int __init smdk_init(void) ...@@ -195,17 +195,21 @@ static int __init smdk_init(void)
ret = platform_device_add(smdk_snd_spdif_device); ret = platform_device_add(smdk_snd_spdif_device);
if (ret) if (ret)
goto err1; goto err3;
/* Set audio clock heirachy manually */ /* Set audio clock heirachy manually */
ret = set_audio_clock_heirachy(smdk_snd_spdif_device); ret = set_audio_clock_heirachy(smdk_snd_spdif_device);
if (ret) if (ret)
goto err1; goto err4;
return 0; return 0;
err1: err4:
platform_device_del(smdk_snd_spdif_device);
err3:
platform_device_put(smdk_snd_spdif_device); platform_device_put(smdk_snd_spdif_device);
err2: err2:
platform_device_del(smdk_snd_spdif_dit_device);
err1:
platform_device_put(smdk_snd_spdif_dit_device); platform_device_put(smdk_snd_spdif_dit_device);
return ret; return ret;
} }
...@@ -213,6 +217,7 @@ static int __init smdk_init(void) ...@@ -213,6 +217,7 @@ static int __init smdk_init(void)
static void __exit smdk_exit(void) static void __exit smdk_exit(void)
{ {
platform_device_unregister(smdk_snd_spdif_device); platform_device_unregister(smdk_snd_spdif_device);
platform_device_unregister(smdk_snd_spdif_dit_device);
} }
module_init(smdk_init); module_init(smdk_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment