Viresh Kumar 202b56890a mfd: wm8994-core: Don't use managed regulator bulk get API
The kernel WARNs and then crashes today if wm8994_device_init() fails
after calling devm_regulator_bulk_get().

That happens because there are multiple devices involved here and the
order in which managed resources are freed isn't correct.

The regulators are added as children of wm8994->dev.  Whereas,
devm_regulator_bulk_get() receives wm8994->dev as the device, though it
gets the same regulators which were added as children of wm8994->dev
earlier.

During failures, the children are removed first and the core eventually
calls regulator_unregister() for them. As regulator_put() was never done
for them (opposite of devm_regulator_bulk_get()), the kernel WARNs at

	WARN_ON(rdev->open_count);

And eventually it crashes from debugfs_remove_recursive().

Fix the kernel warnings and crashes by using regulator_bulk_get()
instead of devm_regulator_bulk_get() and explicitly freeing the supplies
in exit paths.

Tested on Exynos 5250, dual core ARM A15 machine.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2016-11-29 08:21:27 +00:00
..
2016-04-19 07:58:06 +01:00
2016-08-31 10:50:59 +01:00
2015-11-06 10:23:50 -08:00
2016-05-20 11:10:24 -07:00
2016-05-20 11:10:24 -07:00
2016-08-01 07:28:14 -04:00
2016-05-20 11:10:24 -07:00
2015-10-30 17:19:51 +00:00
2015-10-30 17:19:51 +00:00
2016-08-10 09:25:18 +01:00
2016-08-10 09:25:18 +01:00
2016-08-10 09:25:18 +01:00
2015-08-11 15:09:01 +01:00
2015-08-11 15:09:01 +01:00
2015-08-11 15:09:01 +01:00
2015-09-04 11:46:02 -07:00