All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc: kernel: Change the order of of_node_put()
@ 2022-06-17 11:26 ` Liang He
  0 siblings, 0 replies; 15+ messages in thread
From: Liang He @ 2022-06-17 11:26 UTC (permalink / raw)
  To: mpe, benh, paulus, akpm, rppt, christophe.leroy, wangkefeng.wang,
	gpiccoli, aneesh.kumar, dmitry.osipenko
  Cc: windhl, linuxppc-dev, linux-kernel

In add_pcspkr(), it is better to call of_node_put() after the
'if(!np)' check.

Signed-off-by: Liang He <windhl@126.com>
---
 arch/powerpc/kernel/setup-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index eb0077b302e2..761817d1f4db 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -563,9 +563,9 @@ static __init int add_pcspkr(void)
 	int ret;
 
 	np = of_find_compatible_node(NULL, NULL, "pnpPNP,100");
-	of_node_put(np);
 	if (!np)
 		return -ENODEV;
+	of_node_put(np);
 
 	pd = platform_device_alloc("pcspkr", -1);
 	if (!pd)
-- 
2.25.1


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

end of thread, other threads:[~2022-06-20 12:31 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-17 11:26 [PATCH] powerpc: kernel: Change the order of of_node_put() Liang He
2022-06-17 11:26 ` Liang He
2022-06-18  7:13 ` Christophe Leroy
2022-06-18  8:03   ` Liang He
2022-06-18  8:03     ` Liang He
2022-06-18  8:48     ` Christophe Leroy
2022-06-18  8:48       ` Christophe Leroy
2022-06-18 16:20       ` Liang He
2022-06-18 16:20         ` Liang He
2022-06-20  9:23       ` Liang He
2022-06-20  9:23         ` Liang He
2022-06-20 11:11         ` Christophe Leroy
2022-06-20 11:11           ` Christophe Leroy
2022-06-20 12:27           ` Liang He
2022-06-20 12:27             ` Liang He

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.