From: Axel Lin Date: Mon, 22 Nov 2010 00:34:07 +0000 (+0800) Subject: ASoC: Fix a memory leak in alc5623_i2c_probe error path X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=c7b642911ea0fa9168425757752f094a1255209a;p=linux-beck.git ASoC: Fix a memory leak in alc5623_i2c_probe error path Signed-off-by: Axel Lin Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/alc5623.c b/sound/soc/codecs/alc5623.c index e84b26b0ce9e..9783e7e2eb93 100644 --- a/sound/soc/codecs/alc5623.c +++ b/sound/soc/codecs/alc5623.c @@ -1022,10 +1022,8 @@ static int alc5623_i2c_probe(struct i2c_client *client, dev_dbg(&client->dev, "Found codec id : alc56%02x\n", vid2); alc5623 = kzalloc(sizeof(struct alc5623_priv), GFP_KERNEL); - if (alc5623 == NULL) { - ret = -ENOMEM; - goto err; - } + if (alc5623 == NULL) + return -ENOMEM; pdata = client->dev.platform_data; if (pdata) { @@ -1056,12 +1054,9 @@ static int alc5623_i2c_probe(struct i2c_client *client, &soc_codec_device_alc5623, &alc5623_dai, 1); if (ret != 0) { dev_err(&client->dev, "Failed to register codec: %d\n", ret); - goto err; + kfree(alc5623); } - return 0; - -err: return ret; }