Skip to content

Commit

Permalink
regulator: core: Increase refcount for regulator supply's module
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Javier Martinez Canillas authored and Mark Brown committed Jul 16, 2015
1 parent d770e55 commit e2c09ae
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e2c09ae

Please sign in to comment.