From nobody Wed May 13 18:10:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D443C43334 for ; Thu, 16 Jun 2022 03:03:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350668AbiFPDDC (ORCPT ); Wed, 15 Jun 2022 23:03:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347286AbiFPDC5 (ORCPT ); Wed, 15 Jun 2022 23:02:57 -0400 Received: from m15114.mail.126.com (m15114.mail.126.com [220.181.15.114]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 31D6C17A9C for ; Wed, 15 Jun 2022 20:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=mqJbs XLKJyovyR04zCb3Sxx6qLVpngMFn949ve1ky9A=; b=MAAmG2z+cwKuF09xtsA5D DdfnpFNILakoaoZ1MCwPLKxjRtASkX7CyUEkJxWA6M3LorKVWg6fpvOiQi6MDvmh /Px5KDbY9YOllQPvmfOlu5HlQ6ahLhN946DYomBl/4611WDiLgqOPHDkWJQ9hvkV fTIZsoslKn6gscmqcOU8ig= Received: from localhost.localdomain (unknown [124.16.139.61]) by smtp7 (Coremail) with SMTP id DsmowAA3dvVInapi_3aXDQ--.63644S2; Thu, 16 Jun 2022 11:02:33 +0800 (CST) From: Liang He To: linux@armlinux.org.uk Cc: windhl@126.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] arm: mm: (cache-feroceon-l2) Add missing of_node_put() Date: Thu, 16 Jun 2022 11:02:32 +0800 Message-Id: <20220616030232.3974254-1-windhl@126.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: DsmowAA3dvVInapi_3aXDQ--.63644S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7CF45XFW5WFWDur45Jr45trb_yoW8XF15pF yrC3y3Zr4rWrn7ur97tayxZFW7KF4ktFWj9ryUur1rAr45XFyYqrWrKw1Y9wsrtrWrAayF vFWFgr18Za48ZaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pENtxnUUUUU= X-Originating-IP: [124.16.139.61] X-CM-SenderInfo: hzlqvxbo6rjloofrz/1tbi7QoiF1pEANSNYAAAs1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" In feroceon_of_init(), of_find_matching_node() will return a node pointer with refcount incremented. We should use of_node_put() in fail path or when it is not used anymore. Signed-off-by: Liang He Reported-by: kernel test robot --- changelog: v2: (1) use real name (2) fix errors reported by with scritps/checkpatch.pl (3) use goto-label patch style v1: add of_node_put() in fail path=20 arch/arm/mm/cache-feroceon-l2.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/arm/mm/cache-feroceon-l2.c b/arch/arm/mm/cache-feroceon-l= 2.c index 5c1b7a7b9af6..ff17b7df4b09 100644 --- a/arch/arm/mm/cache-feroceon-l2.c +++ b/arch/arm/mm/cache-feroceon-l2.c @@ -368,6 +368,7 @@ int __init feroceon_of_init(void) struct device_node *node; void __iomem *base; bool l2_wt_override =3D false; + int ret; =20 #if defined(CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH) l2_wt_override =3D true; @@ -376,8 +377,10 @@ int __init feroceon_of_init(void) node =3D of_find_matching_node(NULL, feroceon_ids); if (node && of_device_is_compatible(node, "marvell,kirkwood-cache")) { base =3D of_iomap(node, 0); - if (!base) - return -ENOMEM; + if (!base) { + ret =3D -ENOMEM; + goto out_put; + } =20 if (l2_wt_override) writel(readl(base) | L2_WRITETHROUGH_KIRKWOOD, base); @@ -386,7 +389,10 @@ int __init feroceon_of_init(void) } =20 feroceon_l2_init(l2_wt_override); + ret =3D 0; =20 - return 0; +output: + of_node_put(node); + return ret; } #endif --=20 2.25.1