Skip to content

Commit 54c03bf

Browse files
ATRiiXsre
authored andcommitted
power: supply: Fix refcount leak in rk817_charger_probe
of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 11cb8da ("power: supply: Add charger driver for Rockchip RK817") Signed-off-by: Qiheng Lin <[email protected]> Reviewed-by: Chris Morgan <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 571650b commit 54c03bf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/power/supply/rk817_charger.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,8 +1060,10 @@ static int rk817_charger_probe(struct platform_device *pdev)
10601060
return -ENODEV;
10611061

10621062
charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL);
1063-
if (!charger)
1063+
if (!charger) {
1064+
of_node_put(node);
10641065
return -ENOMEM;
1066+
}
10651067

10661068
charger->rk808 = rk808;
10671069

0 commit comments

Comments
 (0)