ASoC: sta32x: Fix a memory leak if snd_soc_register_codec fails
authorAxel Lin <axel.lin@gmail.com>
Sat, 13 Aug 2011 03:33:08 +0000 (11:33 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 15 Aug 2011 13:28:52 +0000 (22:28 +0900)
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/codecs/sta32x.c

index 409d89d1f34c26fb44b58d979256541d798a5dc1..fbd7eb9e61ce197ae9c5bb22df308d618f9545eb 100644 (file)
@@ -857,6 +857,7 @@ static __devinit int sta32x_i2c_probe(struct i2c_client *i2c,
        ret = snd_soc_register_codec(&i2c->dev, &sta32x_codec, &sta32x_dai, 1);
        if (ret != 0) {
                dev_err(&i2c->dev, "Failed to register codec (%d)\n", ret);
+               kfree(sta32x);
                return ret;
        }