linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc: rockchip: Fix refcount leak in rockchip_grf_init
@ 2022-05-16  7:20 Miaoqian Lin
  2022-05-17 17:45 ` Heiko Stuebner
  0 siblings, 1 reply; 2+ messages in thread
From: Miaoqian Lin @ 2022-05-16  7:20 UTC (permalink / raw)
  To: Heiko Stuebner, Miaoqian Lin, Douglas Anderson, linux-arm-kernel,
	linux-rockchip, linux-kernel

of_find_matching_node_and_match 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: 4c58063d4258 ("soc: rockchip: add driver handling grf setup")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/soc/rockchip/grf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/soc/rockchip/grf.c b/drivers/soc/rockchip/grf.c
index 494cf2b5bf7b..343ff61ccccb 100644
--- a/drivers/soc/rockchip/grf.c
+++ b/drivers/soc/rockchip/grf.c
@@ -148,12 +148,14 @@ static int __init rockchip_grf_init(void)
 		return -ENODEV;
 	if (!match || !match->data) {
 		pr_err("%s: missing grf data\n", __func__);
+		of_node_put(np);
 		return -EINVAL;
 	}
 
 	grf_info = match->data;
 
 	grf = syscon_node_to_regmap(np);
+	of_node_put(np);
 	if (IS_ERR(grf)) {
 		pr_err("%s: could not get grf syscon\n", __func__);
 		return PTR_ERR(grf);
-- 
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

* Re: [PATCH] soc: rockchip: Fix refcount leak in rockchip_grf_init
  2022-05-16  7:20 [PATCH] soc: rockchip: Fix refcount leak in rockchip_grf_init Miaoqian Lin
@ 2022-05-17 17:45 ` Heiko Stuebner
  0 siblings, 0 replies; 2+ messages in thread
From: Heiko Stuebner @ 2022-05-17 17:45 UTC (permalink / raw)
  To: Miaoqian Lin, linux-arm-kernel, linux-rockchip, Douglas Anderson,
	linux-kernel
  Cc: Heiko Stuebner

On Mon, 16 May 2022 11:20:10 +0400, Miaoqian Lin wrote:
> of_find_matching_node_and_match 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.

Applied, thanks!

[1/1] soc: rockchip: Fix refcount leak in rockchip_grf_init
      commit: 9b59588d8be91c96bfb0371e912ceb4f16315dbf

Best regards,
-- 
Heiko Stuebner <heiko@sntech.de>

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

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

end of thread, other threads:[~2022-05-17 17:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-16  7:20 [PATCH] soc: rockchip: Fix refcount leak in rockchip_grf_init Miaoqian Lin
2022-05-17 17:45 ` Heiko Stuebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).