cpuidle: big.LITTLE: add of_node_put()
PATCH v3 1/1 cpuidle: big.LITTLE: add of_node_put()
of_find_node_by_path() acquires a reference to the node returned by it and that reference needs to be dropped by its caller. bl_idle_init() doesn't do that, so fix it.
---
Changes in v3:
-update changelog
--- drivers/cpuidle/cpuidle-big_little.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/cpuidle/cpuidle-big_little.c +5 -1
@@ -174,8 +174,12 @@ static int __init bl_idle_init(void)/* * Initialize the driver just for a compliant set of machines */ -if (!of_match_node (compatible_machine_match, root)) +if (!of_match_node (compatible_machine_match, root)){ +of_node_put (root);return -ENODEV ; + } + +of_node_put (root);if (!mcpm_is_available ())return -EUNATCH ;
Signature · 1 line
2.17.0
Quoted 32 lines · Yangtao Li
of_find_node_by_path()acquires a reference to the node returned by it and that reference needs to be dropped by its caller.bl_idle_init()doesn't do that, so fix it.Signed-off-by Yangtao Li <[email protected]>---
Changes in v3:(quoted diff) +0
-2-update changelog --- drivers/cpuidle/cpuidle-big_little.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/cpuidle/cpuidle-big_little.c +5
-2@@ -174,8 +174,12 @@ static int __init bl_idle_init(void)/* * Initialize the driver just for a compliant set of machines */ -if (!of_match_node (compatible_machine_match, root)) +if (!of_match_node (compatible_machine_match, root)){ +of_node_put (root);return -ENODEV ; + } + +of_node_put (root);if (!mcpm_is_available ())return -EUNATCH ; --
Quoted 2 lines
2.17.0
ping......
Quoted 30 lines · CET Frank Lee
Quoted 29 lines · Yangtao Li
of_find_node_by_path()acquires a reference to the node returned by it and that reference needs to be dropped by its caller.bl_idle_init()doesn't do that, so fix it.Signed-off-by Yangtao Li <[email protected]>---
Changes in v3:(quoted diff) +0
-2-update changelog --- drivers/cpuidle/cpuidle-big_little.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/cpuidle/cpuidle-big_little.c +5
-1@@ -174,8 +174,12 @@ static int __init bl_idle_init(void)/* * Initialize the driver just for a compliant set of machines */ -if (!of_match_node (compatible_machine_match, root)) +if (!of_match_node (compatible_machine_match, root)){ +of_node_put (root);return -ENODEV ; + } + +of_node_put (root);
Quoted 6 lines
Quoted 5 lines
drivers/cpuidle/cpuidle-big_little.c +0
-1if (!mcpm_is_available ())return -EUNATCH ; --2.17.0
ping......
I've been waiting for the maintainers of this driver to speak up.
I'll pick up the patch later today or tomorrow unless there are objections.
Thanks,
Rafael
Hi Yangtao,
Quoted 17 lines · Yangtao Li
of_find_node_by_path()acquires a reference to the node returned by it and that reference needs to be dropped by its caller.bl_idle_init()doesn't do that, so fix it.Signed-off-by Yangtao Li <[email protected]>---
Changes in v3:(quoted diff) +0
-2-update changelog --- drivers/cpuidle/cpuidle-big_little.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/cpuidle/cpuidle-big_little.c +0
-0
drivers/cpuidle/cpuidle-big_little.c static int __init bl_idle_init(void) · line 182
Quoted 10 lines
drivers/cpuidle/cpuidle-big_little.c +5
-1@@ -174,8 +174,12 @@ static int __init bl_idle_init(void)/* * Initialize the driver just for a compliant set of machines */ -if (!of_match_node (compatible_machine_match, root)) +if (!of_match_node (compatible_machine_match, root)){ +of_node_put (root);return -ENODEV ; + } + +of_node_put (root);
Don't duplicate the of_node_put.
I suggest:
const struct of_device_id *match_id;
[ ... ]
match_id = of_match_node(compatible_machine_match, root);
of_node_put(root);
if (!match_id)
return -ENODEV;
Quoted 3 lines
drivers/cpuidle/cpuidle-big_little.c +0
-0if (!mcpm_is_available ())return -EUNATCH ;
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Quoted 43 lines · Daniel Lezcano
Hi Yangtao,
Quoted 17 lines · Yangtao Li
of_find_node_by_path()acquires a reference to the node returned by it and that reference needs to be dropped by its caller.bl_idle_init()doesn't do that, so fix it.Signed-off-by Yangtao Li <[email protected]>---
Changes in v3:(quoted diff) +0
-2-update changelog --- drivers/cpuidle/cpuidle-big_little.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/cpuidle/cpuidle-big_little.c +0
-0drivers/cpuidle/cpuidle-big_little.c static int __init bl_idle_init(void) · line 182
Quoted 10 lines
drivers/cpuidle/cpuidle-big_little.c +5
-1@@ -174,8 +174,12 @@ static int __init bl_idle_init(void)/* * Initialize the driver just for a compliant set of machines */ -if (!of_match_node (compatible_machine_match, root)) +if (!of_match_node (compatible_machine_match, root)){ +of_node_put (root);return -ENODEV ; + } + +of_node_put (root);Don't duplicate the
of_node_put.I suggest:
const struct
of_device_id*match_id;[ ... ]
Quoted 8 lines
match_id=of_match_node(compatible_machine_match, root);
of_node_put(root);if (!match_id)
return -ENODEV;
Thank you for your suggestion, the new one has been sent.
Yours,
Yangtao
Quoted 12 lines
drivers/cpuidle/cpuidle-big_little.c static int __init bl_idle_init(void)
Quoted 3 lines
drivers/cpuidle/cpuidle-big_little.c +0
-0if (!mcpm_is_available ())return -EUNATCH ;--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCsFollow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog