lkml.org 
[lkml]   [2018]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] MIPS: generic: fix missing of_node_put()
Date
 of_find_compatible_node() returns a device_node pointer with refcount
incremented and must be decremented explicitly.
As this code is using the result only to check presence of the interrupt
controller (!NULL) but not actually using the result otherwise the
refcount can be decremented here immediately again.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: commit eed0eabd12ef ("MIPS: generic: Introduce generic DT-based board support")
---

Problem located with an experimental coccinelle script

Patch was compiletested with: 32r1_defconfig (implies generic_defconfig)

Patch is against 4.18-rc4 (localversion-next is next-20180711)

arch/mips/generic/init.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/mips/generic/init.c b/arch/mips/generic/init.c
index 07ec084..a106f81 100644
--- a/arch/mips/generic/init.c
+++ b/arch/mips/generic/init.c
@@ -203,6 +203,7 @@ void __init arch_init_irq(void)
"mti,cpu-interrupt-controller");
if (!cpu_has_veic && !intc_node)
mips_cpu_irq_init();
+ of_node_put(intc_node);

irqchip_init();
}
--
2.1.4
\
 
 \ /
  Last update: 2018-07-15 22:05    [W:0.079 / U:0.436 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site