summaryrefslogtreecommitdiff
path: root/sound/soc/samsung
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2010-11-25 15:11:45 +0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-11-25 11:15:00 +0000
commitb26bb71f610f9b346203bff407e4278d98f9fe80 (patch)
treec572628010d5a5f8e48816b70260a3da1865c22a /sound/soc/samsung
parent74bd21e9b301445b57bdcccdd7b5063ad3fbad0f (diff)
ASoC: smdk_wm9713: fix resource leak in smdk_init error path
Fix the error path to properly free allocated resources. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Jassi Brar <jassi.brar@samsung.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/samsung')
-rw-r--r--sound/soc/samsung/smdk_wm9713.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sound/soc/samsung/smdk_wm9713.c b/sound/soc/samsung/smdk_wm9713.c
index 7ce243086e7d..238cb3a38c5d 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;
}