forked from Minki/linux
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:
parent
c48a9d7492
commit
58072cbfc5
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user