diff options
author | Axel Lin <axel.lin@gmail.com> | 2010-11-25 02:11:45 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-11-25 06:15:00 -0500 |
commit | b26bb71f610f9b346203bff407e4278d98f9fe80 (patch) | |
tree | c572628010d5a5f8e48816b70260a3da1865c22a /sound/soc/samsung | |
parent | 74bd21e9b301445b57bdcccdd7b5063ad3fbad0f (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.c | 17 |
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) | |||
70 | 70 | ||
71 | ret = platform_device_add(smdk_snd_wm9713_device); | 71 | ret = platform_device_add(smdk_snd_wm9713_device); |
72 | if (ret) | 72 | if (ret) |
73 | goto err; | 73 | goto err1; |
74 | 74 | ||
75 | smdk_snd_ac97_device = platform_device_alloc("soc-audio", -1); | 75 | smdk_snd_ac97_device = platform_device_alloc("soc-audio", -1); |
76 | if (!smdk_snd_ac97_device) { | 76 | if (!smdk_snd_ac97_device) { |
77 | ret = -ENOMEM; | 77 | ret = -ENOMEM; |
78 | goto err; | 78 | goto err2; |
79 | } | 79 | } |
80 | 80 | ||
81 | platform_set_drvdata(smdk_snd_ac97_device, &smdk); | 81 | platform_set_drvdata(smdk_snd_ac97_device, &smdk); |
82 | 82 | ||
83 | ret = platform_device_add(smdk_snd_ac97_device); | 83 | ret = platform_device_add(smdk_snd_ac97_device); |
84 | if (ret) { | 84 | if (ret) |
85 | platform_device_put(smdk_snd_ac97_device); | 85 | goto err3; |
86 | goto err; | ||
87 | } | ||
88 | 86 | ||
89 | return 0; | 87 | return 0; |
90 | err: | 88 | |
89 | err3: | ||
90 | platform_device_put(smdk_snd_ac97_device); | ||
91 | err2: | ||
92 | platform_device_del(smdk_snd_wm9713_device); | ||
93 | err1: | ||
91 | platform_device_put(smdk_snd_wm9713_device); | 94 | platform_device_put(smdk_snd_wm9713_device); |
92 | return ret; | 95 | return ret; |
93 | } | 96 | } |