Skip to content

Commit

Permalink
regmap: Fix memory leak in regmap_init error path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lars-Peter Clausen authored and Mark Brown committed Nov 10, 2011
1 parent c48a9d7 commit 58072cb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/base/regmap/regmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 58072cb

Please sign in to comment.