diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2010-01-22 12:00:03 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-01-25 09:41:05 -0500 |
commit | 40aa7030e5213a43e9e0554fd7f95534ea310bf3 (patch) | |
tree | efb59c0ce9d22010f374aeeb78fe209f62580fe4 /sound | |
parent | 92dcffb916d309aa01778bf8963a6932e4014d07 (diff) |
ASoC: fix a memory-leak in wm8903
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
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/wm8903.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index ce5515e3f2b0..3595bd57c4eb 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c | |||
@@ -1504,7 +1504,7 @@ static int wm8903_resume(struct platform_device *pdev) | |||
1504 | struct i2c_client *i2c = codec->control_data; | 1504 | struct i2c_client *i2c = codec->control_data; |
1505 | int i; | 1505 | int i; |
1506 | u16 *reg_cache = codec->reg_cache; | 1506 | u16 *reg_cache = codec->reg_cache; |
1507 | u16 *tmp_cache = kmemdup(codec->reg_cache, sizeof(wm8903_reg_defaults), | 1507 | u16 *tmp_cache = kmemdup(reg_cache, sizeof(wm8903_reg_defaults), |
1508 | GFP_KERNEL); | 1508 | GFP_KERNEL); |
1509 | 1509 | ||
1510 | /* Bring the codec back up to standby first to minimise pop/clicks */ | 1510 | /* 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 | for (i = 2; i < ARRAY_SIZE(wm8903_reg_defaults); i++) | 1516 | for (i = 2; i < ARRAY_SIZE(wm8903_reg_defaults); i++) |
1517 | if (tmp_cache[i] != reg_cache[i]) | 1517 | if (tmp_cache[i] != reg_cache[i]) |
1518 | snd_soc_write(codec, i, tmp_cache[i]); | 1518 | snd_soc_write(codec, i, tmp_cache[i]); |
1519 | kfree(tmp_cache); | ||
1519 | } else { | 1520 | } else { |
1520 | dev_err(&i2c->dev, "Failed to allocate temporary cache\n"); | 1521 | dev_err(&i2c->dev, "Failed to allocate temporary cache\n"); |
1521 | } | 1522 | } |