* [PATCH] ARM: imx6: Add missing put_device() call in imx6q_suspend_init()
@ 2019-11-09 15:30 Markus Elfring
0 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2019-11-09 15:30 UTC (permalink / raw)
To: linux-arm-kernel, linux-imx, kernel, Anson Huang, Bjorn Helgaas,
Fabio Estevam, Kohji Okuno, Peng Fan, Petr Mladek,
Richard Fontana, Russell King, Sakari Ailus, Sascha Hauer,
Shawn Guo, Thomas Gleixner
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 9 Nov 2019 16:16:33 +0100
A coccicheck run provided information like the following.
arch/arm/mach-imx/pm-imx6.c:586:1-7: ERROR: missing put_device;
call of_find_device_by_node on line 485, but without a corresponding
object release within this function.
Generated by: scripts/coccinelle/free/put_device.cocci
Thus adjust jump targets to fix the exception handling for this
function implementation.
Fixes: df595746fa69db2e36d89677df26ba51f9706c1b ("ARM: imx: add suspend in ocram support for i.mx6q")
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
arch/arm/mach-imx/pm-imx6.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c
index 1c0ecad3620e..baf3b47601af 100644
--- a/arch/arm/mach-imx/pm-imx6.c
+++ b/arch/arm/mach-imx/pm-imx6.c
@@ -493,14 +493,14 @@ static int __init imx6q_suspend_init(const struct imx6_pm_socdata *socdata)
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, MX6Q_SUSPEND_OCRAM_SIZE);
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);
@@ -523,7 +523,7 @@ static int __init imx6q_suspend_init(const struct imx6_pm_socdata *socdata)
ret = imx6_pm_get_base(&pm_info->mmdc_base, socdata->mmdc_compat);
if (ret) {
pr_warn("%s: failed to get mmdc base %d!\n", __func__, ret);
- goto put_node;
+ goto put_device;
}
ret = imx6_pm_get_base(&pm_info->src_base, socdata->src_compat);
@@ -570,7 +570,7 @@ static int __init imx6q_suspend_init(const struct imx6_pm_socdata *socdata)
&imx6_suspend,
MX6Q_SUSPEND_OCRAM_SIZE - sizeof(*pm_info));
- goto put_node;
+ goto put_device;
pl310_cache_map_failed:
iounmap(pm_info->gpc_base.vbase);
@@ -580,6 +580,8 @@ static int __init imx6q_suspend_init(const struct imx6_pm_socdata *socdata)
iounmap(pm_info->src_base.vbase);
src_map_failed:
iounmap(pm_info->mmdc_base.vbase);
+put_device:
+ put_device(&pdev->dev);
put_node:
of_node_put(node);
--
2.24.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ARM: imx6: add missing put_device() call in imx6q_suspend_init()
2020-06-23 12:11 ` Shawn Guo
@ 2020-06-23 12:46 ` yukuai (C)
0 siblings, 0 replies; 6+ messages in thread
From: yukuai (C) @ 2020-06-23 12:46 UTC (permalink / raw)
To: Shawn Guo
Cc: linux, s.hauer, kernel, festevam, linux-imx, Anson.Huang,
linux-arm-kernel, linux-kernel, yi.zhang
On 2020/6/23 20:11, Shawn Guo wrote:
> On Thu, Jun 04, 2020 at 08:54:49PM +0800, yu kuai wrote:
>> if of_find_device_by_node() succeed, imx6q_suspend_init() doesn't have a
>> corresponding put_device(). Thus add a jump target to fix the exception
>> handling for this function implementation.
>>
>> Signed-off-by: yu kuai <yukuai3@huawei.com>
>
> Applied, thanks.
Hi, Shawn
How about this patch: https://lkml.org/lkml/2020/6/4/428
The patch fix the similar issure.
Thanks!
Yu Kuai
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ARM: imx6: add missing put_device() call in imx6q_suspend_init()
2020-06-04 12:54 [PATCH] ARM: imx6: add " yu kuai
@ 2020-06-23 12:11 ` Shawn Guo
2020-06-23 12:46 ` yukuai (C)
0 siblings, 1 reply; 6+ messages in thread
From: Shawn Guo @ 2020-06-23 12:11 UTC (permalink / raw)
To: yu kuai
Cc: linux, s.hauer, kernel, festevam, linux-imx, Anson.Huang,
linux-arm-kernel, linux-kernel, yi.zhang
On Thu, Jun 04, 2020 at 08:54:49PM +0800, yu kuai wrote:
> if of_find_device_by_node() succeed, imx6q_suspend_init() doesn't have a
> corresponding put_device(). Thus add a jump target to fix the exception
> handling for this function implementation.
>
> Signed-off-by: yu kuai <yukuai3@huawei.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ARM: imx6: add missing put_device() call in imx6q_suspend_init()
2020-06-04 19:07 Markus Elfring
@ 2020-06-05 9:08 ` yukuai (C)
0 siblings, 0 replies; 6+ messages in thread
From: yukuai (C) @ 2020-06-05 9:08 UTC (permalink / raw)
To: Markus Elfring, kernel, linux-arm-kernel, linux-imx
Cc: Anson Huang, Fabio Estevam, Russell King, Sascha Hauer,
Shawn Guo, Yi Zhang, kernel-janitors, LKML
On 2020/6/5 3:07, Markus Elfring wrote:
>> if of_find_device_by_node() succeed, imx6q_suspend_init() 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 useful?
>
> ARM: imx6: Add missing put_device() call in imx6q_suspend_init()
> https://lore.kernel.org/linux-arm-kernel/5acd7308-f6e1-4b1e-c744-bb2e5fdca1be@web.de/
> https://lore.kernel.org/patchwork/patch/1151158/
> https://lkml.org/lkml/2019/11/9/125
Hi, Markus
It is useful indeed. Although I didn't run cocci script, since it can
produce too many false result which is hard to filter out.
BTW, I see you haver done the work already, I guess I won't send any
patches related to 'missing put_device after of_find_device_by_node()'.
Any idea why these pathes didn't get applied ?
Best regards,
Yu Kuai
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ARM: imx6: add missing put_device() call in imx6q_suspend_init()
@ 2020-06-04 19:07 Markus Elfring
2020-06-05 9:08 ` yukuai (C)
0 siblings, 1 reply; 6+ messages in thread
From: Markus Elfring @ 2020-06-04 19:07 UTC (permalink / raw)
To: Yu Kuai, kernel, linux-arm-kernel, linux-imx
Cc: Anson Huang, Fabio Estevam, Russell King, Sascha Hauer,
Shawn Guo, Yi Zhang, kernel-janitors, LKML
> if of_find_device_by_node() succeed, imx6q_suspend_init() 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 useful?
ARM: imx6: Add missing put_device() call in imx6q_suspend_init()
https://lore.kernel.org/linux-arm-kernel/5acd7308-f6e1-4b1e-c744-bb2e5fdca1be@web.de/
https://lore.kernel.org/patchwork/patch/1151158/
https://lkml.org/lkml/2019/11/9/125
Regards,
Markus
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] ARM: imx6: add missing put_device() call in imx6q_suspend_init()
@ 2020-06-04 12:54 yu kuai
2020-06-23 12:11 ` Shawn Guo
0 siblings, 1 reply; 6+ messages in thread
From: yu kuai @ 2020-06-04 12:54 UTC (permalink / raw)
To: linux, shawnguo, s.hauer, kernel, festevam, linux-imx, Anson.Huang
Cc: linux-arm-kernel, linux-kernel, yukuai3, yi.zhang
if of_find_device_by_node() succeed, imx6q_suspend_init() doesn't have a
corresponding put_device(). Thus add a jump target to fix the exception
handling for this function implementation.
Signed-off-by: yu kuai <yukuai3@huawei.com>
---
arch/arm/mach-imx/pm-imx6.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c
index dd34dff13762..40c74b4c4d73 100644
--- a/arch/arm/mach-imx/pm-imx6.c
+++ b/arch/arm/mach-imx/pm-imx6.c
@@ -493,14 +493,14 @@ static int __init imx6q_suspend_init(const struct imx6_pm_socdata *socdata)
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, MX6Q_SUSPEND_OCRAM_SIZE);
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);
@@ -523,7 +523,7 @@ static int __init imx6q_suspend_init(const struct imx6_pm_socdata *socdata)
ret = imx6_pm_get_base(&pm_info->mmdc_base, socdata->mmdc_compat);
if (ret) {
pr_warn("%s: failed to get mmdc base %d!\n", __func__, ret);
- goto put_node;
+ goto put_device;
}
ret = imx6_pm_get_base(&pm_info->src_base, socdata->src_compat);
@@ -570,7 +570,7 @@ static int __init imx6q_suspend_init(const struct imx6_pm_socdata *socdata)
&imx6_suspend,
MX6Q_SUSPEND_OCRAM_SIZE - sizeof(*pm_info));
- goto put_node;
+ goto put_device;
pl310_cache_map_failed:
iounmap(pm_info->gpc_base.vbase);
@@ -580,6 +580,8 @@ static int __init imx6q_suspend_init(const struct imx6_pm_socdata *socdata)
iounmap(pm_info->src_base.vbase);
src_map_failed:
iounmap(pm_info->mmdc_base.vbase);
+put_device:
+ put_device(&pdev->dev);
put_node:
of_node_put(node);
--
2.25.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-06-23 12:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-09 15:30 [PATCH] ARM: imx6: Add missing put_device() call in imx6q_suspend_init() Markus Elfring
2020-06-04 12:54 [PATCH] ARM: imx6: add " yu kuai
2020-06-23 12:11 ` Shawn Guo
2020-06-23 12:46 ` yukuai (C)
2020-06-04 19:07 Markus Elfring
2020-06-05 9:08 ` yukuai (C)
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).