From: Axel Lin Date: Fri, 23 Jul 2010 05:53:52 +0000 (+0000) Subject: ASoC: wm8974: fix a memory leak if another WM8974 is registered X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=4eaac50552395f693b8c428872e8b5311c3dab60;p=deliverable%2Flinux.git ASoC: wm8974: fix a memory leak if another WM8974 is registered 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 Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c index a2c4b2f37cca..1468fe10cbbe 100644 --- a/sound/soc/codecs/wm8974.c +++ b/sound/soc/codecs/wm8974.c @@ -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);