Skip to contentSkip to conversation

cpuidle: big.LITTLE: add of_node_put()

PATCH In review Yangtao Li 3 participants 5 messages Nov 20, 2018 – Dec 10, 2018

Subsystems (2)
lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

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
index db2ede565f1a..650f063ef809 100644
@@ -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
author
#1 lore raw
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.

---
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
index db2ede565f1a..650f063ef809 100644
@@ -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......

#2 lore raw
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.

---
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
index db2ede565f1a..650f063ef809 100644
@@ -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 -1
        if (!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

#3 lore raw
In reply to Yangtao Li

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.

---
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
index db2ede565f1a..650f063ef809 100644

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 -0
 	if (!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
author
#4 lore raw
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.

---
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
index db2ede565f1a..650f063ef809 100644

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;

[ ... ]

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 -0
      if (!mcpm_is_available())
              return -EUNATCH;
 

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