Commit 82874ba4 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mark Brown

regulator: fix device unlinking

Device links are refcounted, device_link_remove() has to be called as
many times as device_link_add().
Signed-off-by: default avatarGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 9df3bb31
......@@ -2058,15 +2058,7 @@ static void _regulator_put(struct regulator *regulator)
debugfs_remove_recursive(regulator->debugfs);
if (regulator->dev) {
int count = 0;
struct regulator *r;
list_for_each_entry(r, &rdev->consumer_list, list)
if (r->dev == regulator->dev)
count++;
if (count == 1)
device_link_remove(regulator->dev, &rdev->dev);
device_link_remove(regulator->dev, &rdev->dev);
/* remove any sysfs entries */
sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment