diff options
author | Mark Brown <broonie@kernel.org> | 2015-08-07 15:01:32 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-08-12 06:01:30 -0400 |
commit | 29f5f4860a8ef9407736594ec43b4fa4152ac7fa (patch) | |
tree | 42cce17d27f2cc5fdc696cd05a68f6b2421198f0 | |
parent | 1768514eebfa888563049fa165449a1c1eba92d8 (diff) |
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>
-rw-r--r-- | drivers/regulator/core.c | 5 |
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[] = { | |||
3598 | static void regulator_dev_release(struct device *dev) | 3598 | static void regulator_dev_release(struct device *dev) |
3599 | { | 3599 | { |
3600 | struct regulator_dev *rdev = dev_get_drvdata(dev); | 3600 | struct regulator_dev *rdev = dev_get_drvdata(dev); |
3601 | |||
3602 | kfree(rdev->constraints); | ||
3603 | of_node_put(rdev->dev.of_node); | ||
3601 | kfree(rdev); | 3604 | kfree(rdev); |
3602 | } | 3605 | } |
3603 | 3606 | ||
@@ -3829,9 +3832,7 @@ void regulator_unregister(struct regulator_dev *rdev) | |||
3829 | unset_regulator_supplies(rdev); | 3832 | unset_regulator_supplies(rdev); |
3830 | list_del(&rdev->list); | 3833 | list_del(&rdev->list); |
3831 | mutex_unlock(®ulator_list_mutex); | 3834 | mutex_unlock(®ulator_list_mutex); |
3832 | kfree(rdev->constraints); | ||
3833 | regulator_ena_gpio_free(rdev); | 3835 | regulator_ena_gpio_free(rdev); |
3834 | of_node_put(rdev->dev.of_node); | ||
3835 | device_unregister(&rdev->dev); | 3836 | device_unregister(&rdev->dev); |
3836 | } | 3837 | } |
3837 | EXPORT_SYMBOL_GPL(regulator_unregister); | 3838 | EXPORT_SYMBOL_GPL(regulator_unregister); |