Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3201571imb; Tue, 5 Mar 2019 03:35:43 -0800 (PST) X-Google-Smtp-Source: APXvYqyVwqQutwZt/wN/PS4UVC6c8CpoN93l0U3lAbnxEoB4lxWjOLTGkmSE1HDpwN9Vdi4Sp89G X-Received: by 2002:a62:5959:: with SMTP id n86mr1366628pfb.237.1551785743455; Tue, 05 Mar 2019 03:35:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551785743; cv=none; d=google.com; s=arc-20160816; b=0ylj7NziZeXNHR+cseYj2luQAMbd4lph8kQCclyLW8KbK9d+76UUmDxa/DlP6WKVBd XempShZoivMA53lYS0gpD+xrSzkuQF3wvJLXJfcG+SHvhRIkZmWvLQS5a2xUP8t2U/b5 A/40nQmmKu4qNJCgssFcbUdoEzWTRZOZtMNBVwxuvkCDCyZTjW51yc4RCo3CBQa21Pie 1xwgyy9GEw/we2xUody8B9sdE+W82+YLrWVKa2AFChtdZq7JmioF7nDsDT1ryai2PmTf nirlZatmglaav0Uh/I9WM0mLugnl+kZvjQOCHGZm+GNHBS4QIe7yz4kcb4guD/D8Zm/j DmwA== 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=Sh2lyLAF/VHlqq+spoB81QL1iiXVz+6SXbmn2HYjijg=; b=DdG11K0K6lBUZ9l8APFnD+zKk/iSFfhAXBhe1XIyfwiTLOg77tWXi4CfAoB3F1+xcI Gmgfhds6vo0VFjTvzIQOMYGP2mrQCsOORbiy58ErJY880hHYPPoRLZ3hOnwhRFziK00A FbvWOBEx7RuXJ80//TYxnvxX2vUHjsnG0cibaPz5G18XGoPTr7Nm8Q2RqjObJU8JVjsJ gMdRDxygyASDxiZvJwRrrzY+nb2/3GxPkk6qlHbVFN9K9ZAWjzwZ9RlBl46rJefkTFEk qAHdIuNw33w6N9iXX+UW/Kcij6wqKCmRyzE4nI1ZJ1PhCxeIqcF+IPeQyUbCkJhkDUZN SBew== 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 m20si7409754pgv.136.2019.03.05.03.35.27; Tue, 05 Mar 2019 03:35:43 -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 S1728016AbfCELeT (ORCPT + 99 others); Tue, 5 Mar 2019 06:34:19 -0500 Received: from mxhk.zte.com.cn ([63.217.80.70]:32496 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727100AbfCELdD (ORCPT ); Tue, 5 Mar 2019 06:33:03 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id A619ADF94734B0412347; Tue, 5 Mar 2019 19:33:01 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x25BWuc1072299; Tue, 5 Mar 2019 19:32:56 +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 2019030519331226-3291527 ; Tue, 5 Mar 2019 19:33:12 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Cc: wang.yi59@zte.com.cn, Wen Yang , Russell King , Kukjin Kim , Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 03/15] ARM: exynos: fix a leaked reference by adding missing of_node_put Date: Tue, 5 Mar 2019 19:33:54 +0800 Message-Id: <1551785646-46173-3-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551785646-46173-1-git-send-email-wen.yang99@zte.com.cn> References: <1551785646-46173-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-05 19:33:12, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-05 19:32:52, Serialize complete at 2019-03-05 19:32:52 X-MAIL: mse01.zte.com.cn x25BWuc1072299 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 Reviewed-by: Florian Fainelli 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 --- v2->v1: add a missing space between "adding" and "missing" 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