提交 e2c09ae7 编写于 作者: J Javier Martinez Canillas 提交者: Mark Brown

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: NJavier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 d770e558
...@@ -1105,6 +1105,9 @@ static int set_supply(struct regulator_dev *rdev, ...@@ -1105,6 +1105,9 @@ static int set_supply(struct regulator_dev *rdev,
rdev_info(rdev, "supplied by %s\n", rdev_get_name(supply_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"); rdev->supply = create_regulator(supply_rdev, &rdev->dev, "SUPPLY");
if (rdev->supply == NULL) { if (rdev->supply == NULL) {
err = -ENOMEM; err = -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册