Skip to contentSkip to conversation

cpufreq: tegra124: add missing of_node_put()

PATCH Superseded Yangtao Li 3 participants 6 messages Feb 4, 2019

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH 1/1 cpufreq: tegra124: add missing of_node_put()

of_cpu_device_node_get() will increase the refcount of device_node, it is necessary to call of_node_put() at the end to release the refcount.

---
 drivers/cpufreq/tegra124-cpufreq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/cpufreq/tegra124-cpufreq.c +2 -0
index 43530254201a..140a9266b64a 100644
@@ -118,6 +118,8 @@ static int tegra124_cpufreq_probe(struct platform_device *pdev)
 		goto out_put_pllx_clk;
 	}
 
+	of_node_put(np);
+
 	ret = tegra124_cpu_switch_to_dfll(priv);
 	if (ret)
 		goto out_put_pllp_clk;
Signature · 1 line
2.17.0
maintainer
#1 lore raw
Quoted 14 lines · Yangtao Li

of_cpu_device_node_get() will increase the refcount of device_node, it is necessary to call of_node_put() at the end to release the refcount.

---
 drivers/cpufreq/tegra124-cpufreq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/cpufreq/tegra124-cpufreq.c +0 -0
index 43530254201a..140a9266b64a 100644

drivers/cpufreq/tegra124-cpufreq.c static int tegra124_cpufreq_probe(struct platform_device *pdev) · line 125

Quoted 8 lines
drivers/cpufreq/tegra124-cpufreq.c +2 -0
@@ -118,6 +118,8 @@ static int tegra124_cpufreq_probe(struct platform_device *pdev)
 		goto out_put_pllx_clk;
 	}
 
+	of_node_put(np);
+
 	ret = tegra124_cpu_switch_to_dfll(priv);
 	if (ret)
 		goto out_put_pllp_clk;

Fixes and stable tags ?

Signature · 1 line
viresh
author
#2 lore raw
Quoted 19 lines · Viresh Kumar
Quoted 17 lines · Yangtao Li

of_cpu_device_node_get() will increase the refcount of device_node, it is necessary to call of_node_put() at the end to release the refcount.

---
 drivers/cpufreq/tegra124-cpufreq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/cpufreq/tegra124-cpufreq.c +0 -0
index 43530254201a..140a9266b64a 100644
@@ -118,6 +118,8 @@ static int tegra124_cpufreq_probe(struct platform_device *pdev)
              goto out_put_pllx_clk;
      }
 
Quoted 7 lines

drivers/cpufreq/tegra124-cpufreq.c static int tegra124_cpufreq_probe(struct platform_device *pdev) · line 125

Quoted 5 lines
drivers/cpufreq/tegra124-cpufreq.c +2 -0
+     of_node_put(np);
+
      ret = tegra124_cpu_switch_to_dfll(priv);
      if (ret)
              goto out_put_pllp_clk;

Fixes and stable tags ?

Hi viresh,

Like this?

Fixes 9eb15dbbfa1a2 ("cpufreq: Add cpufreq driver for Tegra124")

MBR,
Yangtao

Quoted 3 lines

--
viresh

maintainer
#3 lore raw
Quoted 27 lines · Frank Lee
Quoted 19 lines · Viresh Kumar
Quoted 17 lines · Yangtao Li

of_cpu_device_node_get() will increase the refcount of device_node, it is necessary to call of_node_put() at the end to release the refcount.

---
 drivers/cpufreq/tegra124-cpufreq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/cpufreq/tegra124-cpufreq.c +0 -0
index 43530254201a..140a9266b64a 100644
@@ -118,6 +118,8 @@ static int tegra124_cpufreq_probe(struct platform_device *pdev)
              goto out_put_pllx_clk;
      }
 
Quoted 7 lines

drivers/cpufreq/tegra124-cpufreq.c static int tegra124_cpufreq_probe(struct platform_device *pdev) · line 125

Quoted 5 lines
drivers/cpufreq/tegra124-cpufreq.c +2 -0
+     of_node_put(np);
+
      ret = tegra124_cpu_switch_to_dfll(priv);
      if (ret)
              goto out_put_pllp_clk;

Fixes and stable tags ?

Quoted 6 lines

Hi viresh,

Like this?

Fixes 9eb15dbbfa1a2 ("cpufreq: Add cpufreq driver for Tegra124")

This needs to be something like:

Cc 4.5+ [email protected] #4.5+

Also I don't think your patch is entirely correct as we will end up doing of_node_put() twice in error path.

Signature · 1 line
viresh
author
#4 lore raw
Quoted 36 lines · Viresh Kumar
Quoted 27 lines · Frank Lee
Quoted 19 lines · Viresh Kumar
Quoted 17 lines · Yangtao Li

of_cpu_device_node_get() will increase the refcount of device_node, it is necessary to call of_node_put() at the end to release the refcount.

---
 drivers/cpufreq/tegra124-cpufreq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/cpufreq/tegra124-cpufreq.c +0 -0
index 43530254201a..140a9266b64a 100644
@@ -118,6 +118,8 @@ static int tegra124_cpufreq_probe(struct platform_device *pdev)
              goto out_put_pllx_clk;
      }
 
Quoted 7 lines

drivers/cpufreq/tegra124-cpufreq.c static int tegra124_cpufreq_probe(struct platform_device *pdev) · line 125

Quoted 5 lines
drivers/cpufreq/tegra124-cpufreq.c +2 -0
+     of_node_put(np);
+
      ret = tegra124_cpu_switch_to_dfll(priv);
      if (ret)
              goto out_put_pllp_clk;

Fixes and stable tags ?

Quoted 6 lines

Hi viresh,

Like this?

Fixes 9eb15dbbfa1a2 ("cpufreq: Add cpufreq driver for Tegra124")
Quoted 6 lines

This needs to be something like:

Cc 4.5+ [email protected] #4.5+

Also I don't think your patch is entirely correct as we will end up doing of_node_put() twice in error path.

Thanks for your reminder, I will modify it immediately.

MBR,
Yangtao

Quoted 3 lines

--
viresh

#5 lore raw
In reply to Yangtao Li
Quoted 14 lines · Yangtao Li

of_cpu_device_node_get() will increase the refcount of device_node, it is necessary to call of_node_put() at the end to release the refcount.

---
 drivers/cpufreq/tegra124-cpufreq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/cpufreq/tegra124-cpufreq.c +0 -0
index 43530254201a..140a9266b64a 100644

drivers/cpufreq/tegra124-cpufreq.c static int tegra124_cpufreq_probe(struct platform_device *pdev) · line 125

Quoted 8 lines
drivers/cpufreq/tegra124-cpufreq.c +2 -0
@@ -118,6 +118,8 @@ static int tegra124_cpufreq_probe(struct platform_device *pdev)
 		goto out_put_pllx_clk;
 	}
 
+	of_node_put(np);
+
 	ret = tegra124_cpu_switch_to_dfll(priv);
 	if (ret)
 		goto out_put_pllp_clk;

I think this needs to move to the very end of the function, for example after the call to platform_set_drvdata(), to avoid releasing it twice in error paths.

Thierry