All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: mxs: Fix refcount leak in mxs_get_ocotp
@ 2022-05-12  8:52 ` Miaoqian Lin
  0 siblings, 0 replies; 2+ messages in thread
From: Miaoqian Lin @ 2022-05-12  8:52 UTC (permalink / raw)
  To: Russell King, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, NXP Linux Team, Miaoqian Lin, linux-arm-kernel,
	linux-kernel

of_find_compatible_node() returns a node pointer with refcount
incremented, we should use of_node_put() on it when done.
Add missing of_node_put() to avoid refcount leak.

Fixes: 1bff2d76ac88 ("ARM: mxs: move mxs_get_ocotp() into mach-mxs.c")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 arch/arm/mach-mxs/mach-mxs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index 25c9d184fa4c..4af4c3dcfa85 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -99,6 +99,7 @@ static const u32 *mxs_get_ocotp(void)
 	np = of_find_compatible_node(NULL, NULL, "fsl,ocotp");
 	ocotp_base = of_iomap(np, 0);
 	WARN_ON(!ocotp_base);
+	of_node_put(np);
 
 	mutex_lock(&ocotp_mutex);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] ARM: mxs: Fix refcount leak in mxs_get_ocotp
@ 2022-05-12  8:52 ` Miaoqian Lin
  0 siblings, 0 replies; 2+ messages in thread
From: Miaoqian Lin @ 2022-05-12  8:52 UTC (permalink / raw)
  To: Russell King, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, NXP Linux Team, Miaoqian Lin, linux-arm-kernel,
	linux-kernel

of_find_compatible_node() returns a node pointer with refcount
incremented, we should use of_node_put() on it when done.
Add missing of_node_put() to avoid refcount leak.

Fixes: 1bff2d76ac88 ("ARM: mxs: move mxs_get_ocotp() into mach-mxs.c")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 arch/arm/mach-mxs/mach-mxs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index 25c9d184fa4c..4af4c3dcfa85 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -99,6 +99,7 @@ static const u32 *mxs_get_ocotp(void)
 	np = of_find_compatible_node(NULL, NULL, "fsl,ocotp");
 	ocotp_base = of_iomap(np, 0);
 	WARN_ON(!ocotp_base);
+	of_node_put(np);
 
 	mutex_lock(&ocotp_mutex);
 
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-12  8:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12  8:52 [PATCH] ARM: mxs: Fix refcount leak in mxs_get_ocotp Miaoqian Lin
2022-05-12  8:52 ` Miaoqian Lin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.