diff options
author | Liang He <windhl@126.com> | 2022-06-19 12:54:27 +0800 |
---|---|---|
committer | Thomas Bogendoerfer <tsbogend@alpha.franken.de> | 2022-06-21 17:04:54 +0200 |
commit | eb9e9bc4fa5fb489c92ec588b3fb35f042ba6d86 (patch) | |
tree | 92d4b7a7356fd6c5402c90e27d1785a7d8f1090c /arch/mips/pic32/pic32mzda/init.c | |
parent | 76695592711ef1e215cc24ed3e1cd857d7fc3098 (diff) |
mips/pic32/pic32mzda: Fix refcount leak bugs
of_find_matching_node(), of_find_compatible_node() and
of_find_node_by_path() will return node pointers with refcout
incremented. We should call of_node_put() when they are not
used anymore.
Signed-off-by: Liang He <windhl@126.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Diffstat (limited to 'arch/mips/pic32/pic32mzda/init.c')
-rw-r--r-- | arch/mips/pic32/pic32mzda/init.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/mips/pic32/pic32mzda/init.c b/arch/mips/pic32/pic32mzda/init.c index 129915616763..d9c8c4e46aff 100644 --- a/arch/mips/pic32/pic32mzda/init.c +++ b/arch/mips/pic32/pic32mzda/init.c @@ -98,13 +98,18 @@ static int __init pic32_of_prepare_platform_data(struct of_dev_auxdata *lookup) np = of_find_compatible_node(NULL, NULL, lookup->compatible); if (np) { lookup->name = (char *)np->name; - if (lookup->phys_addr) + if (lookup->phys_addr) { + of_node_put(np); continue; + } if (!of_address_to_resource(np, 0, &res)) lookup->phys_addr = res.start; + of_node_put(np); } } + of_node_put(root); + return 0; } |