Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3270224imb; Tue, 5 Mar 2019 05:24:46 -0800 (PST) X-Google-Smtp-Source: APXvYqwfSGRaSgA5+G01imgRlR6bw8LcF51mmDGHxRwr+2tDxULbvVXBTZhPUxMNv6lCTvHb6X2Z X-Received: by 2002:a63:b447:: with SMTP id n7mr1375622pgu.401.1551792285974; Tue, 05 Mar 2019 05:24:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551792285; cv=none; d=google.com; s=arc-20160816; b=anjetvRmK5YKC2l/ct/ZgGolsPbfbgGwNRG7A0izNq9PCTJmf41ZN9n4Tr9TGaKsOv ZGGBthr3dUwXX9fgN3hqQlBNNtRQf0kO/7N+i0KThsEutxHqtlwyrHNR4IKnDYFo6ab8 qy3w/l00TrrSilXlZyD5ryMo+56tEL6eFvoNU1rkogJCDml6OkUreRH+TatgW4AVBoeG aEQZLMQY1xOBAs9oHf/zBMQrOOsIyZaB+zQoqGqxt716IOsTQSPTLL84BfbdEZQAtbFK 7ddJ0FwXhO6UkJmlNpMW5ZhzZjIBK9HcqFRqUoBhrI+vvWVXN1x7uxKDTaSrGKxEtdl3 W29g== 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=L42BiwL7r8Za3C8lG3879ys5cpWe0exSEOGqmFfbaFc=; b=TVZj46aKzrkLtgEJ7cEM+H+aqwGsDSorCeeL5G2XLv+4sAx3hqjgtukLw5cHNXaiPV 6if29ocZlVCK7JxTqq46hndXFUl/AZ5Oz/a3X4YIRLseR/zkujX4DsyfaGsIYNbaShE/ TcIfq4dCWnYvhWs7aAXn5LisrjNDWnz7uAy6GjE8lNlNHCL2nxy+B7uRK2cia+8Gww9G XpfY/BIDQ0A82vB8W41Hl2vxgpDnjMHV/BVaFkjZgaDs/Wcjl+i9yMZjaoqOlKc2Vjjr QvjcVoZ/Pnov28VnF38wMOwZU5LJyHhokpElD+stnjGWJU9dkAopWr7eybx9+6CJ2YQy B/ow== 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 186si259969pfe.262.2019.03.05.05.24.25; 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 S1727796AbfCELcG (ORCPT + 99 others); Tue, 5 Mar 2019 06:32:06 -0500 Received: from out1.zte.com.cn ([202.103.147.172]:40668 "EHLO mxct.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727305AbfCELcD (ORCPT ); Tue, 5 Mar 2019 06:32:03 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id D9C21124F1D1AF286AD5; Tue, 5 Mar 2019 19:32:01 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x25BVsMT071196; Tue, 5 Mar 2019 19:31:54 +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 2019030519321096-3290832 ; Tue, 5 Mar 2019 19:32:10 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Cc: wang.yi59@zte.com.cn, Wen Yang , Maxime Ripard , Chen-Yu Tsai , Russell King , linux-arm-kernel@lists.infradead.org Subject: [PATCH 4/4] ARM: sunxi: fix a leaked reference by adding missing of_node_put Date: Tue, 5 Mar 2019 19:32:57 +0800 Message-Id: <1551785577-45896-4-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551785577-45896-1-git-send-email-wen.yang99@zte.com.cn> References: <1551785577-45896-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:32:11, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-05 19:31:50, Serialize complete at 2019-03-05 19:31:50 X-MAIL: mse01.zte.com.cn x25BVsMT071196 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-sunxi/mc_smp.c:110:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 97, but without a corresponding object release within this functio ./arch/arm/mach-sunxi/platsmp.c:138:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 129, but without a corresponding object release within this function Signed-off-by: Wen Yang Cc: Maxime Ripard Cc: Chen-Yu Tsai Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org (open list) --- arch/arm/mach-sunxi/mc_smp.c | 5 ++++- arch/arm/mach-sunxi/platsmp.c | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-sunxi/mc_smp.c b/arch/arm/mach-sunxi/mc_smp.c index b4037b6..239084c 100644 --- a/arch/arm/mach-sunxi/mc_smp.c +++ b/arch/arm/mach-sunxi/mc_smp.c @@ -89,6 +89,7 @@ static bool sunxi_core_is_cortex_a15(unsigned int core, unsigned int cluster) { struct device_node *node; int cpu = cluster * SUNXI_CPUS_PER_CLUSTER + core; + bool is_compatible; node = of_cpu_device_node_get(cpu); @@ -107,7 +108,9 @@ static bool sunxi_core_is_cortex_a15(unsigned int core, unsigned int cluster) return false; } - return of_device_is_compatible(node, "arm,cortex-a15"); + is_compatible = of_device_is_compatible(node, "arm,cortex-a15"); + of_node_put(node); + return is_compatible; } static int sunxi_cpu_power_switch_set(unsigned int cpu, unsigned int cluster, diff --git a/arch/arm/mach-sunxi/platsmp.c b/arch/arm/mach-sunxi/platsmp.c index c842209..bdde9ef 100644 --- a/arch/arm/mach-sunxi/platsmp.c +++ b/arch/arm/mach-sunxi/platsmp.c @@ -135,6 +135,7 @@ static void __init sun8i_smp_prepare_cpus(unsigned int max_cpus) } prcm_membase = of_iomap(node, 0); + of_node_put(node); if (!prcm_membase) { pr_err("Couldn't map A23 PRCM registers\n"); return; @@ -148,6 +149,7 @@ static void __init sun8i_smp_prepare_cpus(unsigned int max_cpus) } cpucfg_membase = of_iomap(node, 0); + of_node_put(node); if (!cpucfg_membase) pr_err("Couldn't map A23 CPU config registers\n"); -- 2.9.5