summaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2011-03-08 14:39:24 +0300
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-03-08 18:57:24 +0000
commit62f75aafdf180554b4fad29ff1f3827b151d39db (patch)
tree589246b139c34d3561f42115f102477899e8ae50 /sound/soc
parentefb7ac3f9c28fcb379c51f987b63174f727b7453 (diff)
ASoC: sgtl5000: use after free in ldo_regulator_register()
The "ldo" variable was dereferenced after free on the error path. Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/sgtl5000.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index b7e97c02689..1f7217f703e 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -875,11 +875,13 @@ static int ldo_regulator_register(struct snd_soc_codec *codec,
ldo->dev = regulator_register(&ldo->desc, codec->dev,
init_data, ldo);
if (IS_ERR(ldo->dev)) {
+ int ret = PTR_ERR(ldo->dev);
+
dev_err(codec->dev, "failed to register regulator\n");
kfree(ldo->desc.name);
kfree(ldo);
- return PTR_ERR(ldo->dev);
+ return ret;
}
return 0;