]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ASoC: Fix resource leak in goni_wm8994.c
authorAxel Lin <axel.lin@gmail.com>
Fri, 26 Nov 2010 06:51:56 +0000 (14:51 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 29 Nov 2010 10:59:03 +0000 (10:59 +0000)
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>
sound/soc/samsung/goni_wm8994.c

index dcfac546cb8195a6f76fd3985d13cc52156a0d4b..cc8528c0a49aa3a773809cef8b9c9a20c76a1218 100644 (file)
@@ -283,20 +283,25 @@ static int __init goni_init(void)
 
        /* register voice DAI here */
        ret = snd_soc_register_dai(&goni_snd_device->dev, &voice_dai);
-       if (ret)
+       if (ret) {
+               platform_device_put(goni_snd_device);
                return ret;
+       }
 
        platform_set_drvdata(goni_snd_device, &goni);
        ret = platform_device_add(goni_snd_device);
 
-       if (ret)
+       if (ret) {
+               snd_soc_unregister_dai(&goni_snd_device->dev);
                platform_device_put(goni_snd_device);
+       }
 
        return ret;
 }
 
 static void __exit goni_exit(void)
 {
+       snd_soc_unregister_dai(&goni_snd_device->dev);
        platform_device_unregister(goni_snd_device);
 }