From patchwork Sun Dec 18 14:10:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 13076042 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 D7E7AC4332F for ; Sun, 18 Dec 2022 14:12:45 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=S6+jBtl6xElCt2Uf1gHVzcmwJNHQpij/OrtA5l5r4Jw=; b=CrFqx9zmDUeUTC gtXhy3ng+nQEh1EGKnznO6o8cJunATBAjDqn9oclpXI859GjnF3PtbweUotBEngMJXhRjK1IvW/Lw e+5DvziN/9KKkxVdhO6EWhu7Xx9Jh2hJv6cdsyQ2NS1iG4uKpXqooRuMAg6UNBwlW5lUDVKRSHgpu SMhP8FdViVw5VGQwcBuBYwnvnpWMB5nBB/C7rH9J08mXJpwG/9rwT4BOcN/GlQQ0roTEn6nbuEB8c U/tmAgLeec12YTOFaKaMnWzQTprRWoHD9LhZ0ccGIrBKa3d18cMoZlsLcxY6pCRcZtdecQd8bpPpJ oVsQ3/NKzNqkXFMjpWRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p6uNq-0024OX-Lj; Sun, 18 Dec 2022 14:11:18 +0000 Received: from viti.kaiser.cx ([2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p6uNn-0024Lm-4s for linux-arm-kernel@lists.infradead.org; Sun, 18 Dec 2022 14:11:16 +0000 Received: from dslb-178-004-201-210.178.004.pools.vodafone-ip.de ([178.4.201.210] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1p6uNa-00077a-1g; Sun, 18 Dec 2022 15:11:02 +0100 From: Martin Kaiser To: Wei Xu , Russell King Cc: Martin Kaiser , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] ARM: hisi: add missing of_node_put calls Date: Sun, 18 Dec 2022 15:10:29 +0100 Message-Id: <20221218141028.394543-1-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221218_061115_382688_66C92B50 X-CRM114-Status: UNSURE ( 9.60 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org A node that is returned by of_find_compatible_node has its refcount incremented. We have to call of_node_put when the node is no longer needed. For hip04_smp_init, the easiest option is to call of_node_put for all nodes at the end of the function. If we jump to the end of the function because of an error, unused local np... pointers are NULL by default and of_node_put(NULL) just returns. Signed-off-by: Martin Kaiser --- compile-tested only, I don't have this hardware arch/arm/mach-hisi/platmcpm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/mach-hisi/platmcpm.c b/arch/arm/mach-hisi/platmcpm.c index 258586e31333..e4be6da07242 100644 --- a/arch/arm/mach-hisi/platmcpm.c +++ b/arch/arm/mach-hisi/platmcpm.c @@ -341,6 +341,9 @@ static int __init hip04_smp_init(void) err_reloc: memblock_phys_free(hip04_boot_method[0], hip04_boot_method[1]); err: + of_node_put(np); + of_node_put(np_sctl); + of_node_put(np_fab); return ret; } early_initcall(hip04_smp_init);