Skip to content

Commit e2c09ae

Browse files
Javier Martinez Canillasbroonie
authored andcommitted
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>
1 parent d770e55 commit e2c09ae

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/regulator/core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,9 @@ static int set_supply(struct regulator_dev *rdev,
11051105

11061106
rdev_info(rdev, "supplied by %s\n", rdev_get_name(supply_rdev));
11071107

1108+
if (!try_module_get(supply_rdev->owner))
1109+
return -ENODEV;
1110+
11081111
rdev->supply = create_regulator(supply_rdev, &rdev->dev, "SUPPLY");
11091112
if (rdev->supply == NULL) {
11101113
err = -ENOMEM;

0 commit comments

Comments
 (0)