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>
This commit is contained in:
Lars-Peter Clausen 2011-11-10 18:15:15 +01:00 committed by Mark Brown
parent c48a9d7492
commit 58072cbfc5

View File

@ -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: