summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJavier Martinez Canillas <javier@osg.samsung.com>2015-07-15 16:10:28 +0200
committerMark Brown <broonie@kernel.org>2015-07-16 21:38:59 +0100
commite2c09ae7a74d94222187edbe8f5cf1fa9364efcd (patch)
treed133fd8f27f707054ffba6056bfc9c1a58b22ca0 /drivers
parentd770e558e21961ad6cfdf0ff7df0eb5d7d4f0754 (diff)
downloadlwn-e2c09ae7a74d94222187edbe8f5cf1fa9364efcd.tar.gz
lwn-e2c09ae7a74d94222187edbe8f5cf1fa9364efcd.zip
regulator: core: Increase refcount for regulator supply's module
When a regulator is unregistered with regulator_unregister(), a call to regulator_put() is made for its input supply if there is one. This does a module_put() to decrement the refcount of the module that owns the supply but there isn't a corresponding try_module_get() in set_supply() to make the calls balanced. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/regulator/core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index c9f72019bd68..934fde4faebe 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1105,6 +1105,9 @@ static int set_supply(struct regulator_dev *rdev,
rdev_info(rdev, "supplied by %s\n", rdev_get_name(supply_rdev));
+ if (!try_module_get(supply_rdev->owner))
+ return -ENODEV;
+
rdev->supply = create_regulator(supply_rdev, &rdev->dev, "SUPPLY");
if (rdev->supply == NULL) {
err = -ENOMEM;