diff options
author | Axel Lin <axel.lin@gmail.com> | 2010-11-26 01:54:42 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-11-29 06:01:06 -0500 |
commit | d482337eaba627348ffb8b7c0752d65e16667cd9 (patch) | |
tree | 8401fb0e0b6df8f8452b750fe8831be24bb3c695 /sound/soc/samsung/smdk_spdif.c | |
parent | 3790f205465f5c47a3629129af875c94f61f1fd3 (diff) |
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: 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/smdk_spdif.c')
-rw-r--r-- | sound/soc/samsung/smdk_spdif.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sound/soc/samsung/smdk_spdif.c b/sound/soc/samsung/smdk_spdif.c index cd29da089c8f..ca779ad1613c 100644 --- a/sound/soc/samsung/smdk_spdif.c +++ b/sound/soc/samsung/smdk_spdif.c | |||
@@ -183,7 +183,7 @@ static int __init smdk_init(void) | |||
183 | 183 | ||
184 | ret = platform_device_add(smdk_snd_spdif_dit_device); | 184 | ret = platform_device_add(smdk_snd_spdif_dit_device); |
185 | if (ret) | 185 | if (ret) |
186 | goto err2; | 186 | goto err1; |
187 | 187 | ||
188 | smdk_snd_spdif_device = platform_device_alloc("soc-audio", -1); | 188 | smdk_snd_spdif_device = platform_device_alloc("soc-audio", -1); |
189 | if (!smdk_snd_spdif_device) { | 189 | if (!smdk_snd_spdif_device) { |
@@ -195,17 +195,21 @@ static int __init smdk_init(void) | |||
195 | 195 | ||
196 | ret = platform_device_add(smdk_snd_spdif_device); | 196 | ret = platform_device_add(smdk_snd_spdif_device); |
197 | if (ret) | 197 | if (ret) |
198 | goto err1; | 198 | goto err3; |
199 | 199 | ||
200 | /* Set audio clock heirachy manually */ | 200 | /* Set audio clock heirachy manually */ |
201 | ret = set_audio_clock_heirachy(smdk_snd_spdif_device); | 201 | ret = set_audio_clock_heirachy(smdk_snd_spdif_device); |
202 | if (ret) | 202 | if (ret) |
203 | goto err1; | 203 | goto err4; |
204 | 204 | ||
205 | return 0; | 205 | return 0; |
206 | err1: | 206 | err4: |
207 | platform_device_del(smdk_snd_spdif_device); | ||
208 | err3: | ||
207 | platform_device_put(smdk_snd_spdif_device); | 209 | platform_device_put(smdk_snd_spdif_device); |
208 | err2: | 210 | err2: |
211 | platform_device_del(smdk_snd_spdif_dit_device); | ||
212 | err1: | ||
209 | platform_device_put(smdk_snd_spdif_dit_device); | 213 | platform_device_put(smdk_snd_spdif_dit_device); |
210 | return ret; | 214 | return ret; |
211 | } | 215 | } |
@@ -213,6 +217,7 @@ err2: | |||
213 | static void __exit smdk_exit(void) | 217 | static void __exit smdk_exit(void) |
214 | { | 218 | { |
215 | platform_device_unregister(smdk_snd_spdif_device); | 219 | platform_device_unregister(smdk_snd_spdif_device); |
220 | platform_device_unregister(smdk_snd_spdif_dit_device); | ||
216 | } | 221 | } |
217 | 222 | ||
218 | module_init(smdk_init); | 223 | module_init(smdk_init); |