Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp309371imb; Fri, 1 Mar 2019 00:59:01 -0800 (PST) X-Google-Smtp-Source: APXvYqz+1xPG6P+3xLGEce14URO9EzbpB9vDPOFCBPImQXPMJXiO3/19zcK61G5l6HHHMuaDkUVu X-Received: by 2002:a17:902:be15:: with SMTP id r21mr4214508pls.143.1551430741757; Fri, 01 Mar 2019 00:59:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551430741; cv=none; d=google.com; s=arc-20160816; b=Qv+WV6/+l+pvqjcl6DJDXGRVPqTzJLMNsSjMy6H3YQW09trh0MEo27DzhPeKJhMzMJ pMfERhmF3IbIsLwa+Qy7gNSd60qyG8BKKj5aD8RJP3zEI11q8VUS3tjGxJt2EWU4e9lL 6ontjeW1BI3kPmOU7ELYc9lnLTTritMSl4Y4J8bMlF2+G3YQrCtNleI9BBBxXUGkRppA trTlqe+IAxzNAgLh6+JS5bfSP+evQEw8o3yrftRLBoB3iXlg5FAEqmRHWNuS1WA9JRK0 ybW8qDOyMqnSUZbYPXoA92W2babvtVHNQlYzYo8vED+H3NOI39h0S8vZgRPuLHMG8ZZU scfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=aM4L6BVJKrJW6PXD3BsmYtSgBjeA5u2hxPYZTe6q2tM=; b=JMwC25HkHjwjW58mPTm7E9SxW/D4Lg8oipybMW0WLZaIFmlZtlZLEFchPpS8qhoLGA GRQLbxCZS9pXarBbhHoXsQh05iYfjqgS/Goa5h82KytRY/aQcTce+IEefACp58T4MrjZ prHMzxrpHHZvos6/1FdTfsiO+cOvsL9SYUJH4/Ggl1Noc5jACoW4HwcBRX8HSqt4Py/D 27Q1CMEYnLVaT8j2bx6xJDiFgNkI4XO/0U0u2JHC+1Xb2iWIA7O72NTiZ1Q/Cgw7tYUL 4YtlhCW3Pa+p33Jcxwcbz6/um+uxsx/+wkXB37LUfjXWiwrF19NsGjvjkzQZjSEbmk9e +D3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6si19276405plk.126.2019.03.01.00.58.46; Fri, 01 Mar 2019 00:59:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733151AbfCAI5H (ORCPT + 99 others); Fri, 1 Mar 2019 03:57:07 -0500 Received: from mxhk.zte.com.cn ([63.217.80.70]:9558 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733008AbfCAI5G (ORCPT ); Fri, 1 Mar 2019 03:57:06 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id BC2BAED9311404AC15A7; Fri, 1 Mar 2019 16:57:03 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x218utNL086492; Fri, 1 Mar 2019 16:56:55 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019030116573424-2498920 ; Fri, 1 Mar 2019 16:57:34 +0800 From: Wen Yang To: liviu.dudau@arm.com Cc: sudeep.holla@arm.com, lorenzo.pieralisi@arm.com, linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kgene@kernel.org, krzk@kernel.org, linux-samsung-soc@vger.kernel.org, michal.simek@xilinx.com, afaerber@suse.de, manivannan.sadhasivam@linaro.org, dinguyen@kernel.org, heiko@sntech.de, linux-rockchip@lists.infradead.org, f.fainelli@gmail.com, rjui@broadcom.com, sbranden@broadcom.com, bcm-kernel-feedback-list@broadcom.com, linus.walleij@linaro.org, avifishman70@gmail.com, tmaimon77@gmail.com, venture@google.com, yuenn@google.com, brendanhiggins@google.com, openbmc@lists.ozlabs.org, xuwei5@hisilicon.com, maxime.ripard@bootlin.com, wens@csie.org, catalin.marinas@arm.com, will.deacon@arm.com, horms@verge.net.au, magnus.damm@gmail.com, linux-renesas-soc@vger.kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, fabio.estevam@nxp.com, linux-imx@nxp.com, wang.yi59@zte.com.cn, Wen Yang Subject: [PATCH 03/15] ARM: exynos: fix a leaked reference by addingmissing of_node_put Date: Fri, 1 Mar 2019 16:56:44 +0800 Message-Id: <1551430616-42014-3-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551430616-42014-1-git-send-email-wen.yang99@zte.com.cn> References: <1551430616-42014-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-03-01 16:57:34, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-01 16:56:40, Serialize complete at 2019-03-01 16:56:40 X-MAIL: mse01.zte.com.cn x218utNL086492 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 the following warnings: ./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. ./arch/arm/mach-exynos/firmware.c:204:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 193, but without a corresponding object release within this function. ./arch/arm/mach-exynos/suspend.c:642:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 634, but without a corresponding object release within this function. Signed-off-by: Wen Yang Cc: Russell King Cc: Kukjin Kim Cc: Krzysztof Kozlowski Cc: linux-arm-kernel@lists.infradead.org Cc: linux-samsung-soc@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- arch/arm/mach-exynos/firmware.c | 1 + arch/arm/mach-exynos/suspend.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c index d602e3b..2eaf2db 100644 --- a/arch/arm/mach-exynos/firmware.c +++ b/arch/arm/mach-exynos/firmware.c @@ -196,6 +196,7 @@ bool __init exynos_secure_firmware_available(void) return false; addr = of_get_address(nd, 0, NULL, NULL); + of_node_put(nd); if (!addr) { pr_err("%s: No address specified.\n", __func__); return false; diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c index 0850505..9afb0c6 100644 --- a/arch/arm/mach-exynos/suspend.c +++ b/arch/arm/mach-exynos/suspend.c @@ -639,8 +639,10 @@ void __init exynos_pm_init(void) if (WARN_ON(!of_find_property(np, "interrupt-controller", NULL))) { pr_warn("Outdated DT detected, suspend/resume will NOT work\n"); + of_node_put(np); return; } + of_node_put(np); pm_data = (const struct exynos_pm_data *) match->data; -- 2.9.5