]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ASoC: fix a memory-leak in wm8903
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Fri, 22 Jan 2010 17:00:03 +0000 (18:00 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 28 Jan 2010 23:02:35 +0000 (15:02 -0800)
commit 40aa7030e5213a43e9e0554fd7f95534ea310bf3 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
sound/soc/codecs/wm8903.c

index fe1307b500cf5cf30af59b9f83c0310447c08f33..eedf33c085f3b38678069731ab8e436b3960ed17 100644 (file)
@@ -1506,7 +1506,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 */
@@ -1518,6 +1518,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");
        }