mips: cpc: Fix refcount leak in mips_cpc_default_phys_base
authorGong Yuanjun <ruc_gongyuanjun@163.com>
Thu, 7 Apr 2022 04:26:57 +0000 (12:26 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jun 2022 16:36:14 +0000 (18:36 +0200)
[ Upstream commit 4107fa700f314592850e2c64608f6ede4c077476 ]

Add the missing of_node_put() to release the refcount incremented
by of_find_compatible_node().

Signed-off-by: Gong Yuanjun <ruc_gongyuanjun@163.com>
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/mips/kernel/mips-cpc.c

index 8d25351..d005be8 100644 (file)
@@ -27,6 +27,7 @@ phys_addr_t __weak mips_cpc_default_phys_base(void)
        cpc_node = of_find_compatible_node(of_root, NULL, "mti,mips-cpc");
        if (cpc_node) {
                err = of_address_to_resource(cpc_node, 0, &res);
+               of_node_put(cpc_node);
                if (!err)
                        return res.start;
        }