diff options
| author | Axel Lin <axel.lin@gmail.com> | 2010-11-26 01:51:56 -0500 |
|---|---|---|
| committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-11-29 05:59:03 -0500 |
| commit | 853dc30274878d14b7abef8313c801f5559b4c47 (patch) | |
| tree | b9c38fc6bb6d5d2b9e577abfb83453db11d8ba6e | |
| parent | 39fb51a123c125e36e9bcb67686b3e2945784250 (diff) | |
ASoC: Fix resource leak in goni_wm8994.c
Properly free allocated resources in goni_init() error path.
Add missing snd_soc_unregister_dai() in goni_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>
| -rw-r--r-- | sound/soc/samsung/goni_wm8994.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sound/soc/samsung/goni_wm8994.c b/sound/soc/samsung/goni_wm8994.c index dcfac546cb81..cc8528c0a49a 100644 --- a/sound/soc/samsung/goni_wm8994.c +++ b/sound/soc/samsung/goni_wm8994.c | |||
| @@ -283,20 +283,25 @@ static int __init goni_init(void) | |||
| 283 | 283 | ||
| 284 | /* register voice DAI here */ | 284 | /* register voice DAI here */ |
| 285 | ret = snd_soc_register_dai(&goni_snd_device->dev, &voice_dai); | 285 | ret = snd_soc_register_dai(&goni_snd_device->dev, &voice_dai); |
| 286 | if (ret) | 286 | if (ret) { |
| 287 | platform_device_put(goni_snd_device); | ||
| 287 | return ret; | 288 | return ret; |
| 289 | } | ||
| 288 | 290 | ||
| 289 | platform_set_drvdata(goni_snd_device, &goni); | 291 | platform_set_drvdata(goni_snd_device, &goni); |
| 290 | ret = platform_device_add(goni_snd_device); | 292 | ret = platform_device_add(goni_snd_device); |
| 291 | 293 | ||
| 292 | if (ret) | 294 | if (ret) { |
| 295 | snd_soc_unregister_dai(&goni_snd_device->dev); | ||
| 293 | platform_device_put(goni_snd_device); | 296 | platform_device_put(goni_snd_device); |
| 297 | } | ||
| 294 | 298 | ||
| 295 | return ret; | 299 | return ret; |
| 296 | } | 300 | } |
| 297 | 301 | ||
| 298 | static void __exit goni_exit(void) | 302 | static void __exit goni_exit(void) |
| 299 | { | 303 | { |
| 304 | snd_soc_unregister_dai(&goni_snd_device->dev); | ||
| 300 | platform_device_unregister(goni_snd_device); | 305 | platform_device_unregister(goni_snd_device); |
| 301 | } | 306 | } |
| 302 | 307 | ||
