From: yu kuai <yukuai3@huawei.com> To: <dinguyen@kernel.org>, <linux@armlinux.org.uk>, <khilman@linaro.org>, <atull@opensource.altera.com> Cc: <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <yukuai3@huawei.com> Subject: [PATCH] ARM: socfpga: add missing put_device() call in socfpga_setup_ocram_self_refresh() Date: Thu, 4 Jun 2020 21:10:42 +0800 [thread overview] Message-ID: <20200604131042.3926006-1-yukuai3@huawei.com> (raw) 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
WARNING: multiple messages have this Message-ID (diff)
From: yu kuai <yukuai3@huawei.com> To: <dinguyen@kernel.org>, <linux@armlinux.org.uk>, <khilman@linaro.org>, <atull@opensource.altera.com> Cc: yukuai3@huawei.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: socfpga: add missing put_device() call in socfpga_setup_ocram_self_refresh() Date: Thu, 4 Jun 2020 21:10:42 +0800 [thread overview] Message-ID: <20200604131042.3926006-1-yukuai3@huawei.com> (raw) 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2020-06-04 13:11 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-04 13:10 yu kuai [this message] 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-24 8:47 ` yukuai (C) 2020-06-04 18:48 Markus Elfring 2020-06-04 18:48 ` Markus Elfring 2020-06-04 18:48 Markus Elfring 2020-06-04 18:48 ` Markus Elfring
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200604131042.3926006-1-yukuai3@huawei.com \ --to=yukuai3@huawei.com \ --cc=atull@opensource.altera.com \ --cc=dinguyen@kernel.org \ --cc=khilman@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux@armlinux.org.uk \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.