summaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2011-11-10 18:15:15 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-11-10 17:41:20 +0000
commit58072cbfc522c2520e34333a53c8f17bb1adb1a0 (patch)
treef7d877506023930d3aeaa2b7a2ed34a9fa801c95 /drivers/base/regmap
parentc48a9d74926c83f62b0251eff0a3dde259923856 (diff)
downloadblackbird-op-linux-58072cbfc522c2520e34333a53c8f17bb1adb1a0.tar.gz
blackbird-op-linux-58072cbfc522c2520e34333a53c8f17bb1adb1a0.zip
regmap: Fix memory leak in regmap_init error path
If regcache initialization fails regmap_init will currently exit without freeing work_buf. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base/regmap')
-rw-r--r--drivers/base/regmap/regmap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 3e30d168eb1d..b08df85cedff 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -229,12 +229,14 @@ struct regmap *regmap_init(struct device *dev,
ret = regcache_init(map);
if (ret < 0)
- goto err_map;
+ goto err_free_workbuf;
regmap_debugfs_init(map);
return map;
+err_free_workbuf:
+ kfree(map->work_buf);
err_map:
kfree(map);
err:
OpenPOWER on IntegriCloud