From patchwork Wed Mar 9 10:15:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaoqian Lin X-Patchwork-Id: 12774888 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 29938C433EF for ; Wed, 9 Mar 2022 10:17:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=zjMZYMCXfg+gI04ocbGORCtG5rJ2Ck6DHZuUboOoELY=; b=pACWWJz11W4OvR 0SnU01xKlILl3p2Vo5KFKhhW9+Ey7hJTMSMxT+VDttfRrVtBDBUMjdb39aqt1uW7fCc8hZS2vQL1m T43H3h4GO0V272GhMsv4vW1zY5lz4+zjzvPk8mQ0sgDFDgorMu2puDwxGk5IOIaDAsnBcrM4QXXgY 9oLxMckXqN1xtR0bQzrgK3Da77ImqQfTUVQBvRIDUX7DVed1K/ST4Bh8f81SrI9x02HZBk9RoGAWV A7+GW3HIgFjxvH5PKBE6eQxtffzDzwWxwCJ5A4tovVSvJo2KPh3D7PBdCnTorOH4/ViO9fNkZBk5l b6BlTlgKcCSf9BChs9Bg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRtMN-0086xl-1t; Wed, 09 Mar 2022 10:15:59 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRtMK-0086x0-By; Wed, 09 Mar 2022 10:15:57 +0000 Received: by mail-pj1-x1034.google.com with SMTP id z12-20020a17090ad78c00b001bf022b69d6so1895247pju.2; Wed, 09 Mar 2022 02:15:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=odNBjGrfLCCPWEVQUhYnxTpNq5FiPrbmkDJ85NVrPQw=; b=I3KMUvRSQEdnGuaxO5x1JFtWhUj27A9+W0K7Ydv8Kzgvqy1OhZwKt9hhxwhQ9qNfR2 YMdwy4wyCCKDK0bpnFCuHp9LRF0lOLwcZWxOBMBvq95MOWdIoSpm1//SvusoX3+gQnrF SPGee4OLQxyjkMXs8/lMM5l3nLQ0wUEt/bluv+d8Suw61rGFhTzufj8W84MllHV2Lnup pbc7uBKxpQBDvGIzLUjsVqBZpAx71R1bHZgzSX5k/rKCe7PAg9W5ICsdUTLcFBVdPFFt aPv51yw3KP3X58dvOIxi1o49tHbzxI/EDSl9pMa5ld4/ZOJwLS05Mu+mLQp0PFQVeDnq yEBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=odNBjGrfLCCPWEVQUhYnxTpNq5FiPrbmkDJ85NVrPQw=; b=EBwqhejkOAxhgYSgYVSgyzb3+H+Gp6kwtcUEeLEMAM5v85vYV0ANecTMbD7qbGNCOG cenFDagoe9hSzBN1G4rd2xraPCfkq83u8VzpXIzNa0vHfWULRaCRoQl8sB+diGcB0Vm7 bP/DY7hLSCXqRWCfzHvVXIz7RgodY1M242Nr1SIeMUPKwRClekBSja/H02292gP8LBSI YZcDMU5rGfy3lnXvmcpxUcrr1sz8mmYMqPpFMwnJZZM5LK8AJ2JA0md/U90knQjLqeh3 xHfhtyiWjY2YHbjM1g8WQct1AfcRo2rk8QVQHqRvIMsUEXswsv9TJ+iiOgEZWzYiJaAo NNOQ== X-Gm-Message-State: AOAM532BfSdKlUxhSLp+n0WIW/+kA06FGYsu0eLuzeW8CA0PLw+gZF+N hJllLTHiFu+6gk/V6TieZw1jSk8obmiFIjXhoz3CIQ== X-Google-Smtp-Source: ABdhPJza+8kB9vZlu1b2h1E6fBcBlyCbckSr2FJLVWa4fvJBmhCY3ASnKtHhMhkvPCuUtRv9g38faw== X-Received: by 2002:a17:902:da90:b0:152:57b:5e6e with SMTP id j16-20020a170902da9000b00152057b5e6emr6338774plx.103.1646820955248; Wed, 09 Mar 2022 02:15:55 -0800 (PST) Received: from localhost.localdomain ([159.226.95.43]) by smtp.googlemail.com with ESMTPSA id 23-20020a17090a0d5700b001bc3c650e01sm6961452pju.1.2022.03.09.02.15.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Mar 2022 02:15:54 -0800 (PST) From: Miaoqian Lin To: =?utf-8?q?Andreas_F=C3=A4rber?= , Manivannan Sadhasivam , Russell King , linux-arm-kernel@lists.infradead.org, linux-actions@lists.infradead.org, linux-kernel@vger.kernel.org Cc: linmq006@gmail.com Subject: [PATCH] ARM: owl: smp: Fix refcount leak in s500_smp_prepare_cpus Date: Wed, 9 Mar 2022 10:15:49 +0000 Message-Id: <20220309101550.11584-1-linmq006@gmail.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220309_021556_429087_2BA12395 X-CRM114-Status: GOOD ( 10.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The of_find_compatible_node() function returns a node pointer with refcount incremented, We should use of_node_put() on it when done Add the missing of_node_put() to release the refcount. Fixes: 172067e0bc87 ("ARM: owl: Implement CPU enable-method for S500") Fixes: b6a0e18ca690 ("ARM: owl: smp: Implement SPS power-gating for CPU2 and CPU3") Signed-off-by: Miaoqian Lin --- arch/arm/mach-actions/platsmp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/mach-actions/platsmp.c b/arch/arm/mach-actions/platsmp.c index f26618b43514..9fe9a0bd0fd0 100644 --- a/arch/arm/mach-actions/platsmp.c +++ b/arch/arm/mach-actions/platsmp.c @@ -103,6 +103,7 @@ static void __init s500_smp_prepare_cpus(unsigned int max_cpus) } timer_base_addr = of_iomap(node, 0); + of_node_put(node); if (!timer_base_addr) { pr_err("%s: could not map timer registers\n", __func__); return; @@ -115,6 +116,7 @@ static void __init s500_smp_prepare_cpus(unsigned int max_cpus) } sps_base_addr = of_iomap(node, 0); + of_node_put(node); if (!sps_base_addr) { pr_err("%s: could not map sps registers\n", __func__); return; @@ -128,6 +130,7 @@ static void __init s500_smp_prepare_cpus(unsigned int max_cpus) } scu_base_addr = of_iomap(node, 0); + of_node_put(node); if (!scu_base_addr) { pr_err("%s: could not map scu registers\n", __func__); return;