linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Sasha Levin <sashal@kernel.org>,
	nick.child@ibm.com, maz@kernel.org,
	Julia Lawall <Julia.Lawall@lip6.fr>,
	linuxppc-dev@lists.ozlabs.org
Subject: [PATCH AUTOSEL 5.4 02/21] powerpc/6xx: add missing of_node_put
Date: Mon, 17 Jan 2022 12:04:34 -0500	[thread overview]
Message-ID: <20220117170454.1472347-2-sashal@kernel.org> (raw)
In-Reply-To: <20220117170454.1472347-1-sashal@kernel.org>

From: Julia Lawall <Julia.Lawall@lip6.fr>

[ Upstream commit f6e82647ff71d427d4148964b71f239fba9d7937 ]

for_each_compatible_node 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):

// <smpl>
@@
expression e;
local idexpression n;
@@

@@
local idexpression n;
expression e;
@@

 for_each_compatible_node(n,...) {
   ...
(
   of_node_put(n);
|
   e = n
|
+  of_node_put(n);
?  break;
)
   ...
 }
... when != n
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/1448051604-25256-2-git-send-email-Julia.Lawall@lip6.fr
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/powerpc/platforms/embedded6xx/hlwd-pic.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
index a1b7f79a8a152..de10c13de15c6 100644
--- a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
+++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
@@ -215,6 +215,7 @@ void hlwd_pic_probe(void)
 			irq_set_chained_handler(cascade_virq,
 						hlwd_pic_irq_cascade);
 			hlwd_irq_host = host;
+			of_node_put(np);
 			break;
 		}
 	}
-- 
2.34.1


       reply	other threads:[~2022-01-17 17:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220117170454.1472347-1-sashal@kernel.org>
2022-01-17 17:04 ` Sasha Levin [this message]
2022-01-17 17:04 ` [PATCH AUTOSEL 5.4 03/21] powerpc/powernv: add missing of_node_put Sasha Levin
2022-01-17 17:04 ` [PATCH AUTOSEL 5.4 04/21] powerpc/cell: " Sasha Levin
2022-01-17 17:04 ` [PATCH AUTOSEL 5.4 05/21] powerpc/btext: " Sasha Levin
2022-01-17 17:04 ` [PATCH AUTOSEL 5.4 06/21] powerpc/watchdog: Fix missed watchdog reset due to memory ordering race Sasha Levin
2022-01-17 17:04 ` [PATCH AUTOSEL 5.4 08/21] powerpc/smp: Move setup_profiling_timer() under CONFIG_PROFILING Sasha Levin
2022-01-17 17:04 ` [PATCH AUTOSEL 5.4 11/21] powerpc/powermac: Add missing lockdep_register_key() Sasha Levin
2022-01-17 17:04 ` [PATCH AUTOSEL 5.4 12/21] KVM: PPC: Book3S: Suppress failed alloc warning in H_COPY_TOFROM_GUEST Sasha Levin
2022-01-17 17:04 ` [PATCH AUTOSEL 5.4 16/21] powerpc: handle kdump appropriately with crash_kexec_post_notifiers option Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220117170454.1472347-2-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=Julia.Lawall@lip6.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maz@kernel.org \
    --cc=nick.child@ibm.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).