Просмотр исходного кода

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 <axel.lin@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin 15 лет назад
Родитель
Сommit
4eaac50552
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      sound/soc/codecs/wm8974.c

+ 2 - 1
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);