diff options
author | Rhyland Klein <rklein@nvidia.com> | 2013-06-10 17:26:39 -0400 |
---|---|---|
committer | Anton Vorontsov <anton@enomsg.org> | 2013-06-28 21:20:54 -0400 |
commit | 2054d6e90e26b01ac0f125a42fecba63f226e55e (patch) | |
tree | c0798e003a78f5196cd913a3e72a4ce9b0d8a771 /drivers | |
parent | b50df95c8f0703c95625181d2eaf53855c5ebee5 (diff) |
power_supply: Add of_node_put to fix refcount
of_parse_phandle increments the refcount for a dt node before returning
it. Add of_node_put where needed to properly decrement the refcount when
we are done using a given node.
Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/power/power_supply_core.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index 1c517c34e4be..3b2d5df45e7a 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c | |||
@@ -109,8 +109,10 @@ static int __power_supply_populate_supplied_from(struct device *dev, | |||
109 | psy->name, epsy->name); | 109 | psy->name, epsy->name); |
110 | psy->supplied_from[i-1] = (char *)epsy->name; | 110 | psy->supplied_from[i-1] = (char *)epsy->name; |
111 | psy->num_supplies++; | 111 | psy->num_supplies++; |
112 | of_node_put(np); | ||
112 | break; | 113 | break; |
113 | } | 114 | } |
115 | of_node_put(np); | ||
114 | } while (np); | 116 | } while (np); |
115 | 117 | ||
116 | return 0; | 118 | return 0; |
@@ -193,8 +195,10 @@ static int power_supply_check_supplies(struct power_supply *psy) | |||
193 | ret = power_supply_find_supply_from_node(np); | 195 | ret = power_supply_find_supply_from_node(np); |
194 | if (ret) { | 196 | if (ret) { |
195 | dev_dbg(psy->dev, "Failed to find supply, defer!\n"); | 197 | dev_dbg(psy->dev, "Failed to find supply, defer!\n"); |
198 | of_node_put(np); | ||
196 | return -EPROBE_DEFER; | 199 | return -EPROBE_DEFER; |
197 | } | 200 | } |
201 | of_node_put(np); | ||
198 | } while (np); | 202 | } while (np); |
199 | 203 | ||
200 | /* All supplies found, allocate char ** array for filling */ | 204 | /* All supplies found, allocate char ** array for filling */ |