From: Axel Lin Date: Fri, 23 Jul 2010 05:53:44 +0000 (+0000) Subject: ASoC: ak4642: fix a memory leak if failed to initialise AK4642 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=7bcaad919bc7aaa084f5884aa15654fe1fa4c77f;p=openwrt%2Fstaging%2Fblogic.git ASoC: ak4642: fix a memory leak if failed to initialise AK4642 ak4642 should be kfreed if ak4642_init() return error. Signed-off-by: Axel Lin Reviewed-by: Kuninori Morimoto Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index 60b83b482467..3d7dc55305ec 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c @@ -498,8 +498,10 @@ static int ak4642_i2c_probe(struct i2c_client *i2c, codec->control_data = i2c; ret = ak4642_init(ak4642); - if (ret < 0) + if (ret < 0) { printk(KERN_ERR "failed to initialise AK4642\n"); + kfree(ak4642); + } return ret; }