aboutsummaryrefslogtreecommitdiff
path: root/sound/soc
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2010-07-23 05:53:49 +0000
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-08-03 07:45:20 +0100
commitdb1e18de98c8bdf8a2bfc07623ff67621aa4a332 (patch)
tree3681c2d5823befcc606d95bd06f5c4ca310986ae /sound/soc
parent62f5ad6733b872e14d671b615850eb5bd1cd7e30 (diff)
ASoC: wm8940: fix a memory leak if wm8940_register return error
This patch adds checking for wm8940_register return value, and does kfree(wm8940) if wm8940_register() fail. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/wm8940.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
index e3c4bbfaae2..f0c11138e61 100644
--- a/sound/soc/codecs/wm8940.c
+++ b/sound/soc/codecs/wm8940.c
@@ -845,6 +845,7 @@ static void wm8940_unregister(struct wm8940_priv *wm8940)
static int wm8940_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
+ int ret;
struct wm8940_priv *wm8940;
struct snd_soc_codec *codec;
@@ -858,7 +859,11 @@ static int wm8940_i2c_probe(struct i2c_client *i2c,
codec->control_data = i2c;
codec->dev = &i2c->dev;
- return wm8940_register(wm8940, SND_SOC_I2C);
+ ret = wm8940_register(wm8940, SND_SOC_I2C);
+ if (ret < 0)
+ kfree(wm8940);
+
+ return ret;
}
static int __devexit wm8940_i2c_remove(struct i2c_client *client)