Skip to content

Commit

Permalink
ASoC: fix a memory-leak in wm8903
Browse files Browse the repository at this point in the history
Remember to free the temporary register-cache.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
  • Loading branch information
Guennadi Liakhovetski authored and Mark Brown committed Jan 25, 2010
1 parent 92dcffb commit 40aa703
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sound/soc/codecs/wm8903.c
Original file line number Diff line number Diff line change
Expand Up @@ -1504,7 +1504,7 @@ static int wm8903_resume(struct platform_device *pdev)
struct i2c_client *i2c = codec->control_data;
int i;
u16 *reg_cache = codec->reg_cache;
u16 *tmp_cache = kmemdup(codec->reg_cache, sizeof(wm8903_reg_defaults),
u16 *tmp_cache = kmemdup(reg_cache, sizeof(wm8903_reg_defaults),
GFP_KERNEL);

/* Bring the codec back up to standby first to minimise pop/clicks */
Expand All @@ -1516,6 +1516,7 @@ static int wm8903_resume(struct platform_device *pdev)
for (i = 2; i < ARRAY_SIZE(wm8903_reg_defaults); i++)
if (tmp_cache[i] != reg_cache[i])
snd_soc_write(codec, i, tmp_cache[i]);
kfree(tmp_cache);
} else {
dev_err(&i2c->dev, "Failed to allocate temporary cache\n");
}
Expand Down

0 comments on commit 40aa703

Please sign in to comment.