Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Rhyland Klein and committed by
Anton Vorontsov
2054d6e9 b50df95c

+4
+4
drivers/power/power_supply_core.c
··· 109 109 psy->name, epsy->name); 110 110 psy->supplied_from[i-1] = (char *)epsy->name; 111 111 psy->num_supplies++; 112 + of_node_put(np); 112 113 break; 113 114 } 115 + of_node_put(np); 114 116 } while (np); 115 117 116 118 return 0; ··· 195 193 ret = power_supply_find_supply_from_node(np); 196 194 if (ret) { 197 195 dev_dbg(psy->dev, "Failed to find supply, defer!\n"); 196 + of_node_put(np); 198 197 return -EPROBE_DEFER; 199 198 } 199 + of_node_put(np); 200 200 } while (np); 201 201 202 202 /* All supplies found, allocate char ** array for filling */