1 From 629266bf7229cd6a550075f5961f95607b823b59 Mon Sep 17 00:00:00 2001
2 From: Wen Yang <wen.yang99@zte.com.cn>
3 Date: Tue, 5 Mar 2019 19:33:54 +0800
4 Subject: ARM: exynos: Fix a leaked reference by adding missing of_node_put
6 From: Wen Yang <wen.yang99@zte.com.cn>
8 commit 629266bf7229cd6a550075f5961f95607b823b59 upstream.
10 The call to of_get_next_child returns a node pointer with refcount
11 incremented thus it must be explicitly decremented after the last
14 Detected by coccinelle with warnings like:
15 arch/arm/mach-exynos/firmware.c:201:2-8: ERROR: missing of_node_put;
16 acquired a node pointer with refcount incremented on line 193,
17 but without a corresponding object release within this function.
19 Cc: stable@vger.kernel.org
20 Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
21 Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
22 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 arch/arm/mach-exynos/firmware.c | 1 +
26 arch/arm/mach-exynos/suspend.c | 2 ++
27 2 files changed, 3 insertions(+)
29 --- a/arch/arm/mach-exynos/firmware.c
30 +++ b/arch/arm/mach-exynos/firmware.c
31 @@ -196,6 +196,7 @@ bool __init exynos_secure_firmware_avail
34 addr = of_get_address(nd, 0, NULL, NULL);
37 pr_err("%s: No address specified.\n", __func__);
39 --- a/arch/arm/mach-exynos/suspend.c
40 +++ b/arch/arm/mach-exynos/suspend.c
41 @@ -639,8 +639,10 @@ void __init exynos_pm_init(void)
43 if (WARN_ON(!of_find_property(np, "interrupt-controller", NULL))) {
44 pr_warn("Outdated DT detected, suspend/resume will NOT work\n");
50 pm_data = (const struct exynos_pm_data *) match->data;