From: Gong Yuanjun <[email protected]>
Add the missing of_node_put() to release the refcount incremented
by of_find_compatible_node().
Signed-off-by: Gong Yuanjun <[email protected]>
---
arch/mips/kernel/mips-cpc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/mips/kernel/mips-cpc.c b/arch/mips/kernel/mips-cpc.c
index 17aff13cd7ce..3e386f7e1545 100644
--- a/arch/mips/kernel/mips-cpc.c
+++ b/arch/mips/kernel/mips-cpc.c
@@ -28,6 +28,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;
}
--
2.17.1
To += @Thomas
On Thu, Apr 07, 2022 at 12:26:57PM +0800, Yuanjun Gong wrote:
> From: Gong Yuanjun <[email protected]>
>
> Add the missing of_node_put() to release the refcount incremented
> by of_find_compatible_node().
Right, the same bug was fixed in the CDMM driver:
https://lore.kernel.org/linux-mips/[email protected]/
Good catch. Thanks.
Reviewed-by: Serge Semin <[email protected]>
-Sergey
>
> Signed-off-by: Gong Yuanjun <[email protected]>
> ---
> arch/mips/kernel/mips-cpc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/mips/kernel/mips-cpc.c b/arch/mips/kernel/mips-cpc.c
> index 17aff13cd7ce..3e386f7e1545 100644
> --- a/arch/mips/kernel/mips-cpc.c
> +++ b/arch/mips/kernel/mips-cpc.c
> @@ -28,6 +28,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;
> }
> --
> 2.17.1
>
On Thu, Apr 07, 2022 at 12:26:57PM +0800, Yuanjun Gong wrote:
> From: Gong Yuanjun <[email protected]>
>
> Add the missing of_node_put() to release the refcount incremented
> by of_find_compatible_node().
>
> Signed-off-by: Gong Yuanjun <[email protected]>
> ---
> arch/mips/kernel/mips-cpc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/mips/kernel/mips-cpc.c b/arch/mips/kernel/mips-cpc.c
> index 17aff13cd7ce..3e386f7e1545 100644
> --- a/arch/mips/kernel/mips-cpc.c
> +++ b/arch/mips/kernel/mips-cpc.c
> @@ -28,6 +28,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;
> }
> --
> 2.17.1
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]