* [PATCH] ARM: socfpga: Fix object reference leaks in socfpga_setup_ocram_self_refresh
@ 2019-03-26 23:53 Huang Zijiang
2019-03-27 7:17 ` Mukesh Ojha
0 siblings, 1 reply; 2+ messages in thread
From: Huang Zijiang @ 2019-03-26 23:53 UTC (permalink / raw)
To: dinguyen; +Cc: linux, linux-arm-kernel, linux-kernel, wang.yi59, Huang Zijiang
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@zte.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ARM: socfpga: Fix object reference leaks in socfpga_setup_ocram_self_refresh
2019-03-26 23:53 [PATCH] ARM: socfpga: Fix object reference leaks in socfpga_setup_ocram_self_refresh Huang Zijiang
@ 2019-03-27 7:17 ` Mukesh Ojha
0 siblings, 0 replies; 2+ messages in thread
From: Mukesh Ojha @ 2019-03-27 7:17 UTC (permalink / raw)
To: Huang Zijiang, dinguyen; +Cc: linux, linux-arm-kernel, linux-kernel, wang.yi59
On 3/27/2019 5:23 AM, Huang Zijiang wrote:
> 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@zte.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);
of_node_put is called twice for put_node label.
Thanks,
Mukesh
>
> return ret;
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-27 7:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-26 23:53 [PATCH] ARM: socfpga: Fix object reference leaks in socfpga_setup_ocram_self_refresh Huang Zijiang
2019-03-27 7:17 ` Mukesh Ojha
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).