summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2010-11-25 08:12:30 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-11-25 12:09:30 +0100
commit14abca3dfc51c0a4f798183f131d63bfd6552bd4 (patch)
treea5ee6e865dc407dc9dab1bcadf0b817c1cc8a1c0
parentASoC: sam9g20_wm8731: fix resource leak in at91sam9g20ek_init error path (diff)
downloadlinux-14abca3dfc51c0a4f798183f131d63bfd6552bd4.tar.xz
linux-14abca3dfc51c0a4f798183f131d63bfd6552bd4.zip
ASoC: simone: fix resource leak in simone_init error path
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> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--sound/soc/ep93xx/simone.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/sound/soc/ep93xx/simone.c b/sound/soc/ep93xx/simone.c
index 4b0d19913728..286817946c56 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;
}