lkml.org 
[lkml]   [2015]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 1/2] regulator: core: Increase refcount for regulator supply's module
Date
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>
---

Changes in v2: None

drivers/regulator/core.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 68b616580533..1dd2024b46b3 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1109,6 +1109,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;
--
2.4.3


\
 
 \ /
  Last update: 2015-07-15 16:21    [W:0.086 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site