linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc-km82xx.c: replace of_node_put with __free improves cleanup
@ 2024-07-09 14:35 David Hunter
  2024-11-17 12:09 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: David Hunter @ 2024-07-09 14:35 UTC (permalink / raw)
  To: mpe, npiggin, christophe.leroy, naveen.n.rao, linuxppc-dev,
	linux-kernel
  Cc: julia.lawall, javier.carrasco.cruz, David Hunter, skhan

The use of the __free function allows the cleanup to be based on scope
instead of on another function called later. This makes the cleanup
automatic and less susceptible to errors later.

This code was compiled without errors or warnings.

Signed-off-by: David Hunter <david.hunter.linux@gmail.com>
---
 arch/powerpc/platforms/82xx/km82xx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/82xx/km82xx.c b/arch/powerpc/platforms/82xx/km82xx.c
index c86da3f2b74b..5791c9c5acd0 100644
--- a/arch/powerpc/platforms/82xx/km82xx.c
+++ b/arch/powerpc/platforms/82xx/km82xx.c
@@ -27,15 +27,15 @@
 
 static void __init km82xx_pic_init(void)
 {
-	struct device_node *np = of_find_compatible_node(NULL, NULL,
-							"fsl,pq2-pic");
+	struct device_node *np __free(device_node) = of_find_compatible_node(NULL,
+									     NULL,
+									     "fsl,pq2-pic");
 	if (!np) {
 		pr_err("PIC init: can not find cpm-pic node\n");
 		return;
 	}
 
 	cpm2_pic_init(np);
-	of_node_put(np);
 }
 
 struct cpm_pin {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-17 12:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-09 14:35 [PATCH] powerpc-km82xx.c: replace of_node_put with __free improves cleanup David Hunter
2024-11-17 12:09 ` Michael Ellerman

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).