提交 5420f307 编写于 作者: M Mark Brown

ASoC: Fix leaks in WM8988 registration error handling

Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 1a01417e
...@@ -902,7 +902,7 @@ static int wm8988_register(struct wm8988_priv *wm8988) ...@@ -902,7 +902,7 @@ static int wm8988_register(struct wm8988_priv *wm8988)
ret = wm8988_reset(codec); ret = wm8988_reset(codec);
if (ret < 0) { if (ret < 0) {
dev_err(codec->dev, "Failed to issue reset\n"); dev_err(codec->dev, "Failed to issue reset\n");
return ret; goto err;
} }
/* set the update bits (we always update left then right) */ /* set the update bits (we always update left then right) */
...@@ -926,18 +926,20 @@ static int wm8988_register(struct wm8988_priv *wm8988) ...@@ -926,18 +926,20 @@ static int wm8988_register(struct wm8988_priv *wm8988)
ret = snd_soc_register_codec(codec); ret = snd_soc_register_codec(codec);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to register codec: %d\n", ret); dev_err(codec->dev, "Failed to register codec: %d\n", ret);
return ret; goto err;
} }
ret = snd_soc_register_dai(&wm8988_dai); ret = snd_soc_register_dai(&wm8988_dai);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to register DAI: %d\n", ret); dev_err(codec->dev, "Failed to register DAI: %d\n", ret);
snd_soc_unregister_codec(codec); snd_soc_unregister_codec(codec);
return ret; goto err_codec;
} }
return 0; return 0;
err_codec:
snd_soc_unregister_codec(codec);
err: err:
kfree(wm8988); kfree(wm8988);
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册