* [PATCH] ARM: socfpga: PM: Add missing put_device() call in socfpga_setup_ocram_self_refresh()
@ 2019-11-09 18:01 Markus Elfring
0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2019-11-09 18:01 UTC (permalink / raw)
To: linux-arm-kernel, Alan Tull, Dinh Nguyen, Kevin Hilman, Russell King
Cc: Geert Uytterhoeven, kernel-janitors, LKML, Arnd Bergmann
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 9 Nov 2019 18:48:44 +0100
A coccicheck run provided information like the following.
arch/arm/mach-socfpga/pm.c:87:1-7: ERROR: missing put_device;
call of_find_device_by_node on line 41, but without a corresponding
object release within this function.
Generated by: scripts/coccinelle/free/put_device.cocci
Thus add the missed function call to fix the resource management for
this function implementation.
Fixes: 44fd8c7d4005f660f48679439f0a54225ba234a4 ("ARM: socfpga: support suspend to ram")
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
arch/arm/mach-socfpga/pm.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-socfpga/pm.c b/arch/arm/mach-socfpga/pm.c
index 6ed887cf8dc9..365c0428b21b 100644
--- a/arch/arm/mach-socfpga/pm.c
+++ b/arch/arm/mach-socfpga/pm.c
@@ -49,14 +49,14 @@ static int socfpga_setup_ocram_self_refresh(void)
if (!ocram_pool) {
pr_warn("%s: ocram pool unavailable!\n", __func__);
ret = -ENODEV;
- goto put_node;
+ goto put_device;
}
ocram_base = gen_pool_alloc(ocram_pool, socfpga_sdram_self_refresh_sz);
if (!ocram_base) {
pr_warn("%s: unable to alloc ocram!\n", __func__);
ret = -ENOMEM;
- goto put_node;
+ goto put_device;
}
ocram_pbase = gen_pool_virt_to_phys(ocram_pool, ocram_base);
@@ -67,7 +67,7 @@ static int socfpga_setup_ocram_self_refresh(void)
if (!suspend_ocram_base) {
pr_warn("%s: __arm_ioremap_exec failed!\n", __func__);
ret = -ENOMEM;
- goto put_node;
+ goto put_device;
}
/* Copy the code that puts DDR in self refresh to ocram */
@@ -81,6 +81,8 @@ static int socfpga_setup_ocram_self_refresh(void)
if (!socfpga_sdram_self_refresh_in_ocram)
ret = -EFAULT;
+put_device:
+ put_device(&pdev->dev);
put_node:
of_node_put(np);
--
2.24.0
_______________________________________________
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] 3+ messages in thread
* Re: [PATCH] ARM: socfpga: PM: add missing put_device() call in socfpga_setup_ocram_self_refresh()
2020-07-21 13:45 [PATCH] ARM: socfpga: PM: add " Yu Kuai
@ 2020-07-28 19:18 ` Dinh Nguyen
0 siblings, 0 replies; 3+ messages in thread
From: Dinh Nguyen @ 2020-07-28 19:18 UTC (permalink / raw)
To: Yu Kuai, linux, atull, khilman; +Cc: linux-kernel, linux-arm-kernel, yi.zhang
On 7/21/20 8:45 AM, Yu Kuai wrote:
> if of_find_device_by_node() succeed, socfpga_setup_ocram_self_refresh
> doesn't have a corresponding put_device(). Thus add a jump target to
> fix the exception handling for this function implementation.
>
> Fixes: 44fd8c7d4005 ("ARM: socfpga: support suspend to ram")
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> ---
> arch/arm/mach-socfpga/pm.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-socfpga/pm.c b/arch/arm/mach-socfpga/pm.c
> index 6ed887cf8dc9..365c0428b21b 100644
> --- a/arch/arm/mach-socfpga/pm.c
> +++ b/arch/arm/mach-socfpga/pm.c
> @@ -49,14 +49,14 @@ static int socfpga_setup_ocram_self_refresh(void)
> if (!ocram_pool) {
> pr_warn("%s: ocram pool unavailable!\n", __func__);
> ret = -ENODEV;
> - goto put_node;
> + goto put_device;
> }
>
> ocram_base = gen_pool_alloc(ocram_pool, socfpga_sdram_self_refresh_sz);
> if (!ocram_base) {
> pr_warn("%s: unable to alloc ocram!\n", __func__);
> ret = -ENOMEM;
> - goto put_node;
> + goto put_device;
> }
>
> ocram_pbase = gen_pool_virt_to_phys(ocram_pool, ocram_base);
> @@ -67,7 +67,7 @@ static int socfpga_setup_ocram_self_refresh(void)
> if (!suspend_ocram_base) {
> pr_warn("%s: __arm_ioremap_exec failed!\n", __func__);
> ret = -ENOMEM;
> - goto put_node;
> + goto put_device;
> }
>
> /* Copy the code that puts DDR in self refresh to ocram */
> @@ -81,6 +81,8 @@ static int socfpga_setup_ocram_self_refresh(void)
> if (!socfpga_sdram_self_refresh_in_ocram)
> ret = -EFAULT;
>
> +put_device:
> + put_device(&pdev->dev);
> put_node:
> of_node_put(np);
>
>
Applied!
Thanks,
Dinh
_______________________________________________
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] 3+ messages in thread
* [PATCH] ARM: socfpga: PM: add missing put_device() call in socfpga_setup_ocram_self_refresh()
@ 2020-07-21 13:45 Yu Kuai
2020-07-28 19:18 ` Dinh Nguyen
0 siblings, 1 reply; 3+ messages in thread
From: Yu Kuai @ 2020-07-21 13:45 UTC (permalink / raw)
To: dinguyen, linux, atull, khilman
Cc: yukuai3, linux-kernel, linux-arm-kernel, yi.zhang
if of_find_device_by_node() succeed, socfpga_setup_ocram_self_refresh
doesn't have a corresponding put_device(). Thus add a jump target to
fix the exception handling for this function implementation.
Fixes: 44fd8c7d4005 ("ARM: socfpga: support suspend to ram")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
arch/arm/mach-socfpga/pm.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-socfpga/pm.c b/arch/arm/mach-socfpga/pm.c
index 6ed887cf8dc9..365c0428b21b 100644
--- a/arch/arm/mach-socfpga/pm.c
+++ b/arch/arm/mach-socfpga/pm.c
@@ -49,14 +49,14 @@ static int socfpga_setup_ocram_self_refresh(void)
if (!ocram_pool) {
pr_warn("%s: ocram pool unavailable!\n", __func__);
ret = -ENODEV;
- goto put_node;
+ goto put_device;
}
ocram_base = gen_pool_alloc(ocram_pool, socfpga_sdram_self_refresh_sz);
if (!ocram_base) {
pr_warn("%s: unable to alloc ocram!\n", __func__);
ret = -ENOMEM;
- goto put_node;
+ goto put_device;
}
ocram_pbase = gen_pool_virt_to_phys(ocram_pool, ocram_base);
@@ -67,7 +67,7 @@ static int socfpga_setup_ocram_self_refresh(void)
if (!suspend_ocram_base) {
pr_warn("%s: __arm_ioremap_exec failed!\n", __func__);
ret = -ENOMEM;
- goto put_node;
+ goto put_device;
}
/* Copy the code that puts DDR in self refresh to ocram */
@@ -81,6 +81,8 @@ static int socfpga_setup_ocram_self_refresh(void)
if (!socfpga_sdram_self_refresh_in_ocram)
ret = -EFAULT;
+put_device:
+ put_device(&pdev->dev);
put_node:
of_node_put(np);
--
2.25.4
_______________________________________________
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] 3+ messages in thread
end of thread, other threads:[~2020-07-28 19:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-09 18:01 [PATCH] ARM: socfpga: PM: Add missing put_device() call in socfpga_setup_ocram_self_refresh() Markus Elfring
2020-07-21 13:45 [PATCH] ARM: socfpga: PM: add " Yu Kuai
2020-07-28 19:18 ` Dinh Nguyen
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).