]> asedeno.scripts.mit.edu Git - linux.git/commit
power: supply: core: fix leaked of_node refs in power_supply_get_battery_info
authorWen Yang <wen.yang99@zte.com.cn>
Wed, 17 Apr 2019 02:43:03 +0000 (10:43 +0800)
committerSebastian Reichel <sre@kernel.org>
Wed, 17 Apr 2019 20:19:12 +0000 (22:19 +0200)
commit2143bf6d7cfe74feb5694fba7e9000ddcd5fb25e
tree3ebf3c80c7d8af3a6d91214f15401311498e9a06
parent0b646fd1b1963bf44fe81853e89f3469aeb94a6c
power: supply: core: fix leaked of_node refs in power_supply_get_battery_info

The call to of_parse_phandle returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.

Detected by coccinelle with the following warnings:
./drivers/power/supply/power_supply_core.c:601:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 595, but without a corresponding object release within this function.
./drivers/power/supply/power_supply_core.c:604:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 595, but without a corresponding object release within this function.
./drivers/power/supply/power_supply_core.c:632:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 595, but without a corresponding object release within this function.
./drivers/power/supply/power_supply_core.c:635:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 595, but without a corresponding object release within this function.
./drivers/power/supply/power_supply_core.c:653:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 595, but without a corresponding object release within this function.
./drivers/power/supply/power_supply_core.c:664:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 595, but without a corresponding object release within this function.
./drivers/power/supply/power_supply_core.c:673:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 595, but without a corresponding object release within this function.

Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/power_supply_core.c