diff options
| author | Axel Lin <axel.lin@gmail.com> | 2010-11-25 02:12:30 -0500 |
|---|---|---|
| committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-11-25 06:09:30 -0500 |
| commit | 14abca3dfc51c0a4f798183f131d63bfd6552bd4 (patch) | |
| tree | a5ee6e865dc407dc9dab1bcadf0b817c1cc8a1c0 | |
| parent | c7a734e58ed237ecac2608a70eb31ba64e21c768 (diff) | |
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.c | 18 |
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) | |||
| 54 | 54 | ||
| 55 | ret = platform_device_add(simone_snd_ac97_device); | 55 | ret = platform_device_add(simone_snd_ac97_device); |
| 56 | if (ret) | 56 | if (ret) |
| 57 | goto fail; | 57 | goto fail1; |
| 58 | 58 | ||
| 59 | simone_snd_device = platform_device_alloc("soc-audio", -1); | 59 | simone_snd_device = platform_device_alloc("soc-audio", -1); |
| 60 | if (!simone_snd_device) { | 60 | if (!simone_snd_device) { |
| 61 | ret = -ENOMEM; | 61 | ret = -ENOMEM; |
| 62 | goto fail; | 62 | goto fail2; |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | platform_set_drvdata(simone_snd_device, &snd_soc_simone); | 65 | platform_set_drvdata(simone_snd_device, &snd_soc_simone); |
| 66 | ret = platform_device_add(simone_snd_device); | 66 | ret = platform_device_add(simone_snd_device); |
| 67 | if (ret) { | 67 | if (ret) |
| 68 | platform_device_put(simone_snd_device); | 68 | goto fail3; |
| 69 | goto fail; | ||
| 70 | } | ||
| 71 | 69 | ||
| 72 | return ret; | 70 | return 0; |
| 73 | 71 | ||
| 74 | fail: | 72 | fail3: |
| 73 | platform_device_put(simone_snd_device); | ||
| 74 | fail2: | ||
| 75 | platform_device_del(simone_snd_ac97_device); | ||
| 76 | fail1: | ||
| 75 | platform_device_put(simone_snd_ac97_device); | 77 | platform_device_put(simone_snd_ac97_device); |
| 76 | return ret; | 78 | return ret; |
| 77 | } | 79 | } |
