summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2015-08-07 22:01:32 +0300
committerMark Brown <broonie@kernel.org>2015-08-12 13:01:30 +0300
commit29f5f4860a8ef9407736594ec43b4fa4152ac7fa (patch)
tree42cce17d27f2cc5fdc696cd05a68f6b2421198f0 /drivers/regulator
parent1768514eebfa888563049fa165449a1c1eba92d8 (diff)
downloadlinux-29f5f4860a8ef9407736594ec43b4fa4152ac7fa.tar.xz
regulator: core: Move more deallocation into class unregister
We really ought to be using the class dvice lifetime management features more than we are rather than open coding them so take a step towards that by moving some of the simplest deallocations to the dev_release() function. Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 89be8e287275..01a0a78368b8 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3598,6 +3598,9 @@ static const struct attribute_group *regulator_dev_groups[] = {
static void regulator_dev_release(struct device *dev)
{
struct regulator_dev *rdev = dev_get_drvdata(dev);
+
+ kfree(rdev->constraints);
+ of_node_put(rdev->dev.of_node);
kfree(rdev);
}
@@ -3829,9 +3832,7 @@ void regulator_unregister(struct regulator_dev *rdev)
unset_regulator_supplies(rdev);
list_del(&rdev->list);
mutex_unlock(&regulator_list_mutex);
- kfree(rdev->constraints);
regulator_ena_gpio_free(rdev);
- of_node_put(rdev->dev.of_node);
device_unregister(&rdev->dev);
}
EXPORT_SYMBOL_GPL(regulator_unregister);