]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
ASoC: wm8974: fix a memory leak if another WM8974 is registered
authorAxel Lin <axel.lin@gmail.com>
Fri, 23 Jul 2010 05:53:52 +0000 (05:53 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 3 Aug 2010 06:46:07 +0000 (07:46 +0100)
wm8974 is allocated in wm8974_i2c_probe() but is not freed if wm8974_register()
return -EINVAL (if another WM8974 is registered).

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/codecs/wm8974.c

index a2c4b2f37ccac22d01ee364419954a712c22373d..1468fe10cbbe54d57ce5d072b5406261487d2bc8 100644 (file)
@@ -670,7 +670,8 @@ static __devinit int wm8974_register(struct wm8974_priv *wm8974)
 
        if (wm8974_codec) {
                dev_err(codec->dev, "Another WM8974 is registered\n");
-               return -EINVAL;
+               ret = -EINVAL;
+               goto err;
        }
 
        mutex_init(&codec->mutex);