From 58072cbfc522c2520e34333a53c8f17bb1adb1a0 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Thu, 10 Nov 2011 18:15:15 +0100 Subject: [PATCH] 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 Signed-off-by: Mark Brown --- drivers/base/regmap/regmap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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: -- 2.34.1