* [PATCH] powerpc/cell: Fix refcount leak bugs
@ 2022-06-19 7:23 Liang He
2022-09-09 12:07 ` Michael Ellerman
0 siblings, 1 reply; 2+ messages in thread
From: Liang He @ 2022-06-19 7:23 UTC (permalink / raw)
To: jk, arnd, mpe, benh, paulus; +Cc: windhl, linuxppc-dev, linux-kernel
We should use of_node_put() for of_find_node_by_path() and
of_find_node_by_phandle() to keep refcount balance.
Signed-off-by: Liang He <windhl@126.com>
---
arch/powerpc/platforms/cell/setup.c | 2 ++
arch/powerpc/platforms/cell/spu_manage.c | 2 ++
arch/powerpc/platforms/cell/spufs/inode.c | 1 +
3 files changed, 5 insertions(+)
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index 52de014983c9..47eaf75349f2 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -167,6 +167,8 @@ static int __init cell_publish_devices(void)
of_platform_device_create(np, NULL, NULL);
}
+ of_node_put(root);
+
/* There is no device for the MIC memory controller, thus we create
* a platform device for it to attach the EDAC driver to.
*/
diff --git a/arch/powerpc/platforms/cell/spu_manage.c b/arch/powerpc/platforms/cell/spu_manage.c
index ae09c5a91b40..f1ac4c742069 100644
--- a/arch/powerpc/platforms/cell/spu_manage.c
+++ b/arch/powerpc/platforms/cell/spu_manage.c
@@ -488,6 +488,8 @@ static void __init init_affinity_node(int cbe)
avoid_ph = vic_dn->phandle;
}
+ of_node_put(vic_dn);
+
list_add_tail(&spu->aff_list, &last_spu->aff_list);
last_spu = spu;
break;
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 34334c32b7f5..320008528edd 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -660,6 +660,7 @@ spufs_init_isolated_loader(void)
return;
loader = of_get_property(dn, "loader", &size);
+ of_node_put(dn);
if (!loader)
return;
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-09 12:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-19 7:23 [PATCH] powerpc/cell: Fix refcount leak bugs Liang He
2022-09-09 12:07 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®