Skip to content
Snippets Groups Projects
Commit 7bcaad91 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown
Browse files

ASoC: ak4642: fix a memory leak if failed to initialise AK4642


ak4642 should be kfreed if ak4642_init() return error.

Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Reviewed-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent fd3c8ac9
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment