Skip to content

Commit 629266b

Browse files
tasksetkrzk
authored andcommitted
ARM: exynos: Fix a leaked reference by adding missing of_node_put
The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with warnings like: arch/arm/mach-exynos/firmware.c:201:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 193, but without a corresponding object release within this function. Cc: [email protected] Signed-off-by: Wen Yang <[email protected]> Signed-off-by: Krzysztof Kozlowski <[email protected]>
1 parent 4d8e3e9 commit 629266b

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

arch/arm/mach-exynos/firmware.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ bool __init exynos_secure_firmware_available(void)
196196
return false;
197197

198198
addr = of_get_address(nd, 0, NULL, NULL);
199+
of_node_put(nd);
199200
if (!addr) {
200201
pr_err("%s: No address specified.\n", __func__);
201202
return false;

arch/arm/mach-exynos/suspend.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,8 +669,10 @@ void __init exynos_pm_init(void)
669669

670670
if (WARN_ON(!of_find_property(np, "interrupt-controller", NULL))) {
671671
pr_warn("Outdated DT detected, suspend/resume will NOT work\n");
672+
of_node_put(np);
672673
return;
673674
}
675+
of_node_put(np);
674676

675677
pm_data = (const struct exynos_pm_data *) match->data;
676678

0 commit comments

Comments
 (0)