提交 40aa7030 编写于 作者: G Guennadi Liakhovetski 提交者: Mark Brown

ASoC: fix a memory-leak in wm8903

Remember to free the temporary register-cache.
Signed-off-by: NGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: NLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
上级 92dcffb9
...@@ -1504,7 +1504,7 @@ static int wm8903_resume(struct platform_device *pdev) ...@@ -1504,7 +1504,7 @@ static int wm8903_resume(struct platform_device *pdev)
struct i2c_client *i2c = codec->control_data; struct i2c_client *i2c = codec->control_data;
int i; int i;
u16 *reg_cache = codec->reg_cache; 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); GFP_KERNEL);
/* Bring the codec back up to standby first to minimise pop/clicks */ /* Bring the codec back up to standby first to minimise pop/clicks */
...@@ -1516,6 +1516,7 @@ static int wm8903_resume(struct platform_device *pdev) ...@@ -1516,6 +1516,7 @@ static int wm8903_resume(struct platform_device *pdev)
for (i = 2; i < ARRAY_SIZE(wm8903_reg_defaults); i++) for (i = 2; i < ARRAY_SIZE(wm8903_reg_defaults); i++)
if (tmp_cache[i] != reg_cache[i]) if (tmp_cache[i] != reg_cache[i])
snd_soc_write(codec, i, tmp_cache[i]); snd_soc_write(codec, i, tmp_cache[i]);
kfree(tmp_cache);
} else { } else {
dev_err(&i2c->dev, "Failed to allocate temporary cache\n"); dev_err(&i2c->dev, "Failed to allocate temporary cache\n");
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册