linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: socfpga: add missing put_device() call in socfpga_setup_ocram_self_refresh()
@ 2020-06-04 13:10 yu kuai
  2020-06-24  8:47 ` yukuai (C)
  0 siblings, 1 reply; 4+ messages in thread
From: yu kuai @ 2020-06-04 13:10 UTC (permalink / raw)
  To: dinguyen, linux, khilman, atull; +Cc: linux-arm-kernel, linux-kernel, yukuai3

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 | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-socfpga/pm.c b/arch/arm/mach-socfpga/pm.c
index 6ed887cf8dc9..7267f5da15a4 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 */
@@ -80,7 +80,12 @@ static int socfpga_setup_ocram_self_refresh(void)
 	     "could not copy function to ocram");
 	if (!socfpga_sdram_self_refresh_in_ocram)
 		ret = -EFAULT;
+
+	if (!ret)
+		goto put_node;
 
+put_device:
+	put_device(&pdev->dev);
 put_node:
 	of_node_put(np);
 
-- 
2.25.4


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

* Re: [PATCH] ARM: socfpga: add missing put_device() call in socfpga_setup_ocram_self_refresh()
  2020-06-04 13:10 [PATCH] ARM: socfpga: add missing put_device() call in socfpga_setup_ocram_self_refresh() yu kuai
@ 2020-06-24  8:47 ` yukuai (C)
  0 siblings, 0 replies; 4+ messages in thread
From: yukuai (C) @ 2020-06-24  8:47 UTC (permalink / raw)
  To: dinguyen, linux, khilman, atull; +Cc: linux-arm-kernel, linux-kernel

ping?

On 2020/6/4 21:10, 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 | 11 ++++++++---
>   1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-socfpga/pm.c b/arch/arm/mach-socfpga/pm.c
> index 6ed887cf8dc9..7267f5da15a4 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 */
> @@ -80,7 +80,12 @@ static int socfpga_setup_ocram_self_refresh(void)
>   	     "could not copy function to ocram");
>   	if (!socfpga_sdram_self_refresh_in_ocram)
>   		ret = -EFAULT;
> +
> +	if (!ret)
> +		goto put_node;
>   
> +put_device:
> +	put_device(&pdev->dev);
>   put_node:
>   	of_node_put(np);
>   
> 


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

* Re: [PATCH] ARM: socfpga: add missing put_device() call in socfpga_setup_ocram_self_refresh()
@ 2020-06-04 18:48 Markus Elfring
  0 siblings, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2020-06-04 18:48 UTC (permalink / raw)
  To: Yu Kuai, linux-arm-kernel
  Cc: Alan Tull, Dinh Nguyen, Kevin Hilman, Arnd Bergmann,
	Geert Uytterhoeven, Russell King, kernel-janitors, LKML

> 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.

Do you find a previous update suggestion interesting?

ARM: socfpga: PM: Add missing put_device() call in socfpga_setup_ocram_self_refresh()
https://lore.kernel.org/linux-arm-kernel/c45a8e00-3fc9-adba-1a46-5f2c4149953e@web.de/
https://lore.kernel.org/patchwork/patch/1151166/
https://lkml.org/lkml/2019/11/9/156

Do you propose to adjust the source code a bit more?

Regards,
Markus

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

* Re: [PATCH] ARM: socfpga: add missing put_device() call in socfpga_setup_ocram_self_refresh()
@ 2020-06-04 18:48 Markus Elfring
  0 siblings, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2020-06-04 18:48 UTC (permalink / raw)
  To: Yu Kuai, linux-arm-kernel
  Cc: Alan Tull, Dinh Nguyen, Kevin Hilman, Arnd Bergmann,
	Geert Uytterhoeven, Russell King, kernel-janitors, LKML

> 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.

Do you find a previous update suggestion interesting?

ARM: socfpga: PM: Add missing put_device() call in socfpga_setup_ocram_self_refresh()
https://lore.kernel.org/linux-arm-kernel/c45a8e00-3fc9-adba-1a46-5f2c4149953e@web.de/
https://lore.kernel.org/patchwork/patch/1151166/
https://lkml.org/lkml/2019/11/9/156

Do you propose to adjust the source code a bit more?

Regards,
Markus

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

end of thread, other threads:[~2020-06-24  8:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-04 13:10 [PATCH] ARM: socfpga: add missing put_device() call in socfpga_setup_ocram_self_refresh() yu kuai
2020-06-24  8:47 ` yukuai (C)
2020-06-04 18:48 Markus Elfring
2020-06-04 18:48 Markus Elfring

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).