diff mbox series

ARM: hisi: add missing of_node_put calls

Message ID 20221218141028.394543-1-martin@kaiser.cx (mailing list archive)
State New, archived
Headers show
Series ARM: hisi: add missing of_node_put calls | expand

Commit Message

Martin Kaiser Dec. 18, 2022, 2:10 p.m. UTC
A node that is returned by of_find_compatible_node has its refcount
incremented. We have to call of_node_put when the node is no longer
needed.

For hip04_smp_init, the easiest option is to call of_node_put for all
nodes at the end of the function. If we jump to the end of the function
because of an error, unused local np... pointers are NULL by default
and of_node_put(NULL) just returns.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
compile-tested only, I don't have this hardware

 arch/arm/mach-hisi/platmcpm.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/arch/arm/mach-hisi/platmcpm.c b/arch/arm/mach-hisi/platmcpm.c
index 258586e31333..e4be6da07242 100644
--- a/arch/arm/mach-hisi/platmcpm.c
+++ b/arch/arm/mach-hisi/platmcpm.c
@@ -341,6 +341,9 @@  static int __init hip04_smp_init(void)
 err_reloc:
 	memblock_phys_free(hip04_boot_method[0], hip04_boot_method[1]);
 err:
+	of_node_put(np);
+	of_node_put(np_sctl);
+	of_node_put(np_fab);
 	return ret;
 }
 early_initcall(hip04_smp_init);