lkml.org 
[lkml]   [2022]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] ARM: imx35: Fix refcount leak in mx35_read_cpu_rev
Date
The of_find_compatible_node() function returns a node pointer with
refcount incremented, We should use of_node_put() on it when done
Add the missing of_node_put() to release the refcount.

Fixes: f68ea682d1da ("ARM: imx35: Retrieve the IIM base address from devicetree")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
arch/arm/mach-imx/cpu-imx35.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-imx/cpu-imx35.c b/arch/arm/mach-imx/cpu-imx35.c
index 80e7d8ab9f1b..3ae4a3dc44fb 100644
--- a/arch/arm/mach-imx/cpu-imx35.c
+++ b/arch/arm/mach-imx/cpu-imx35.c
@@ -22,6 +22,7 @@ static int mx35_read_cpu_rev(void)
np = of_find_compatible_node(NULL, NULL, "fsl,imx35-iim");
iim_base = of_iomap(np, 0);
BUG_ON(!iim_base);
+ of_node_put(np);

rev = imx_readl(iim_base + MXC_IIMSREV);
switch (rev) {
--
2.17.1
\
 
 \ /
  Last update: 2022-04-21 13:06    [W:0.174 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site