diff options
author | Axel Lin <axel.lin@gmail.com> | 2010-07-23 01:53:44 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-08-03 02:40:41 -0400 |
commit | 7bcaad919bc7aaa084f5884aa15654fe1fa4c77f (patch) | |
tree | 5fbee6344f610b7ebb598ca1c01240c644cb63b2 | |
parent | fd3c8ac9cb653f7e3122bba9bc7beaad6062b7f4 (diff) |
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 <axel.lin@gmail.com>
Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | sound/soc/codecs/ak4642.c | 4 |
1 files changed, 3 insertions, 1 deletions
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, | |||
498 | codec->control_data = i2c; | 498 | codec->control_data = i2c; |
499 | 499 | ||
500 | ret = ak4642_init(ak4642); | 500 | ret = ak4642_init(ak4642); |
501 | if (ret < 0) | 501 | if (ret < 0) { |
502 | printk(KERN_ERR "failed to initialise AK4642\n"); | 502 | printk(KERN_ERR "failed to initialise AK4642\n"); |
503 | kfree(ak4642); | ||
504 | } | ||
503 | 505 | ||
504 | return ret; | 506 | return ret; |
505 | } | 507 | } |