Skip to content

Commit

Permalink
ASoC: ak4642: fix a memory leak if failed to initialise AK4642
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Axel Lin authored and Mark Brown committed Aug 3, 2010
1 parent fd3c8ac commit 7bcaad9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sound/soc/codecs/ak4642.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 7bcaad9

Please sign in to comment.