Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3270227imb; Tue, 5 Mar 2019 05:24:46 -0800 (PST) X-Google-Smtp-Source: APXvYqwx6CM/DIlLE6VDyC3JikSdnWgebWBLEK5SoOVXLUiUGfo3smtstMkZPgsb7tK5ZTeMso3M X-Received: by 2002:a62:46cc:: with SMTP id o73mr1897620pfi.182.1551792286000; Tue, 05 Mar 2019 05:24:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551792285; cv=none; d=google.com; s=arc-20160816; b=xOiCDa6GiQyFsfAhpB9xr+frG86rPx6283Rc1rh0Bta8oX4ooH/jI8HR6RrVJOcfyH tPaViSsjvFK3porgbLlIX89A9u2Z+44uSmUEskB+G2IbB6LxY41uQS5wJKvD0L5nSFEq JK+raUxj+bP4kQF0R6s5nbK2smTu8pOo+aiZSYhZWwjyHSgNF/Nwx9BBPI1KzaOZqIQi 6MhJSGqhD3vCDO/Dutx32EpPIeLYLFK0RKvVKkq9a/N9MAT2ihlvLNfsjsQLH2MzOcnh QMrU4FSv0DgMgXKN4EZgnS9Gunc0XRyE8ZswwqoKWM8TVzTkA5dlbxgHozltRq9oo49U 3UMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=kcfqMtDqq3ydWO1f0FB0J/PrBs8lUzpbo79kUIPe6XU=; b=li9o351fTH1celwZIwhWNTGEPgN39gWG8RkPe9oRomGqYwhB1f9osc0jnv9ATzY4+s JnSUHZ6ZnZ1RR6OHBEG7E+YRmQ0k7XZUAe+v7R+2i1fXAujbhZX5KSTyGd3ZOXnU0e6m TGyA/b2ugC7XfpxVGWuhKHCYojD+UxeBR08CbfjfGodM4uiqESpjxX2Rmbg3ps1CCJUA Tv7JChYMuKbZkoPD+jFF4AF/mDHzpg40Nmj4pgCH0fJXM2nMtZYbp5yHwwR0vA4x+T6z zl2hO6udg73uGITdADlop/M0ojHZnO6DhkhAvT0Pnrt3QzvI4nGbg6MxUOFb5Wxzr2TY iLcg== 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 u1si8175153plz.246.2019.03.05.05.24.09; Tue, 05 Mar 2019 05:24:45 -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 S1727791AbfCELb6 (ORCPT + 99 others); Tue, 5 Mar 2019 06:31:58 -0500 Received: from mxhk.zte.com.cn ([63.217.80.70]:58986 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727213AbfCELb6 (ORCPT ); Tue, 5 Mar 2019 06:31:58 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 4693789E01186A5FB42F; Tue, 5 Mar 2019 19:31:55 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x25BVpfe071141; Tue, 5 Mar 2019 19:31:51 +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 2019030519320223-3290722 ; Tue, 5 Mar 2019 19:32:02 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Cc: wang.yi59@zte.com.cn, Wen Yang , Florian Fainelli , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, Russell King , Brian Norris , Gregory Fong , linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/4] ARM: brcmstb: fix a leaked reference by adding missing of_node_put Date: Tue, 5 Mar 2019 19:32:54 +0800 Message-Id: <1551785577-45896-1-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-03-05 19:32:02, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-05 19:31:47, Serialize complete at 2019-03-05 19:31:47 X-MAIL: mse01.zte.com.cn x25BVpfe071141 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-bcm/platsmp-brcmstb.c:337:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 329, but without a corresponding object release within this function. ./arch/arm/mach-bcm/platsmp-brcmstb.c:341:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 329, but without a corresponding object release within this functio ./arch/arm/mach-bcm/bcm63xx_smp.c:150:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 130, but without a corresponding object release within this function. Signed-off-by: Wen Yang Cc: Florian Fainelli Cc: Ray Jui Cc: Scott Branden Cc: bcm-kernel-feedback-list@broadcom.com Cc: Russell King Cc: Brian Norris Cc: Gregory Fong Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- arch/arm/mach-bcm/bcm63xx_smp.c | 1 + arch/arm/mach-bcm/platsmp-brcmstb.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-bcm/bcm63xx_smp.c b/arch/arm/mach-bcm/bcm63xx_smp.c index f5fb10b..1cb4ce8 100644 --- a/arch/arm/mach-bcm/bcm63xx_smp.c +++ b/arch/arm/mach-bcm/bcm63xx_smp.c @@ -142,6 +142,7 @@ static int bcm63138_smp_boot_secondary(unsigned int cpu, * return */ ret = bcm63xx_pmb_power_on_cpu(dn); + of_node_put(dn); if (ret) goto out; out: diff --git a/arch/arm/mach-bcm/platsmp-brcmstb.c b/arch/arm/mach-bcm/platsmp-brcmstb.c index 1237996..4555f21 100644 --- a/arch/arm/mach-bcm/platsmp-brcmstb.c +++ b/arch/arm/mach-bcm/platsmp-brcmstb.c @@ -334,11 +334,14 @@ static void __init brcmstb_cpu_ctrl_setup(unsigned int max_cpus) rc = setup_hifcpubiuctrl_regs(np); if (rc) - return; + goto out_put_node; rc = setup_hifcont_regs(np); if (rc) - return; + goto out_put_node; + +out_put_node: + of_node_put(np); } static int brcmstb_boot_secondary(unsigned int cpu, struct task_struct *idle) -- 2.9.5