From mboxrd@z Thu Jan 1 00:00:00 1970 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 93FCAC433EF for ; Mon, 17 Jan 2022 17:45:32 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Jczp316s5z3jJT for ; Tue, 18 Jan 2022 04:45:31 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=nrOOne6m; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2604:1380:4601:e00::1; helo=ams.source.kernel.org; envelope-from=sashal@kernel.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=nrOOne6m; dkim-atps=neutral Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Jcyyy3kb3z3f9h for ; Tue, 18 Jan 2022 04:08:10 +1100 (AEDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AB532B8113E; Mon, 17 Jan 2022 17:08:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5330C36AEF; Mon, 17 Jan 2022 17:08:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642439286; bh=bZMho04zzMVM6kYWcyHEghrY3neLzEAufpfoVc5JEsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nrOOne6mhIPMCQgjTbjjmtxb1BMgpsIzxuuR1WndIV1hr+7b3HK/eKha1BDJ5q6kW jzHMwTNmcW3LnNJ49VrSEccwmlOLIBM6JcX3t6vNXuL12/EBfjkwPcwJLD8zu5rVCR zkm6qNd7mUTOsWU6gP6Kv5sNl9AoovbIQRWWcZ6xFzMDO6PqeTFvnyTsTpDmDkL2mc pEtiAUx141ucaIsZaXtf0aE6AgZVfJPpqZh7jpiG/aMW2mUY/MPQiH3e7qvDQ4HV0N 04aJ0MK6g56/G0G95fR7ypo/YJ+o/kS/T6HF8vSv7x9Zv2SAX3MALrpAbOU5uhGFHY eDivXIM+jQEgA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 4.4 04/12] powerpc/btext: add missing of_node_put Date: Mon, 17 Jan 2022 12:07:48 -0500 Message-Id: <20220117170757.1473318-4-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220117170757.1473318-1-sashal@kernel.org> References: <20220117170757.1473318-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , Julia Lawall , linuxppc-dev@lists.ozlabs.org, nick.child@ibm.com Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Julia Lawall [ Upstream commit a1d2b210ffa52d60acabbf7b6af3ef7e1e69cda0 ] for_each_node_by_type performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. A simplified version of the semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ local idexpression n; expression e; @@ for_each_node_by_type(n,...) { ... ( of_node_put(n); | e = n | + of_node_put(n); ? break; ) ... } ... when != n // Signed-off-by: Julia Lawall Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/1448051604-25256-6-git-send-email-Julia.Lawall@lip6.fr Signed-off-by: Sasha Levin --- arch/powerpc/kernel/btext.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c index 41c011cb60706..8d05ef26dea9d 100644 --- a/arch/powerpc/kernel/btext.c +++ b/arch/powerpc/kernel/btext.c @@ -257,8 +257,10 @@ int __init btext_find_display(int allow_nonstdout) rc = btext_initialize(np); printk("result: %d\n", rc); } - if (rc == 0) + if (rc == 0) { + of_node_put(np); break; + } } return rc; } -- 2.34.1