[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1553644422-42950-1-git-send-email-huang.zijiang@zte.com.cn>
Date: Wed, 27 Mar 2019 07:53:42 +0800
From: Huang Zijiang <huang.zijiang@....com.cn>
To: dinguyen@...nel.org
Cc: linux@...linux.org.uk, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, wang.yi59@....com.cn,
Huang Zijiang <huang.zijiang@....com.cn>
Subject: [PATCH] ARM: socfpga: Fix object reference leaks in socfpga_setup_ocram_self_refresh
The of_find_device_by_node() takes a reference to the underlying device
structure, we should release that reference.
Signed-off-by: Huang Zijiang <huang.zijiang@....com.cn>
---
arch/arm/mach-socfpga/pm.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-socfpga/pm.c b/arch/arm/mach-socfpga/pm.c
index d486678..8d7ca14 100644
--- a/arch/arm/mach-socfpga/pm.c
+++ b/arch/arm/mach-socfpga/pm.c
@@ -53,7 +53,7 @@ static int socfpga_setup_ocram_self_refresh(void)
if (!pdev) {
pr_warn("%s: failed to find ocram device!\n", __func__);
ret = -ENODEV;
- goto put_node;
+ goto fail;
}
ocram_pool = gen_pool_get(&pdev->dev, NULL);
@@ -94,6 +94,9 @@ static int socfpga_setup_ocram_self_refresh(void)
put_node:
of_node_put(np);
+ put_device(&np->dev);
+fail:
+ of_node_put(np);
return ret;
}
--
1.8.3.1
Powered by blists - more mailing lists