Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58072cbf authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Mark Brown
Browse files

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: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent c48a9d74
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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: