Skip to contentSkip to conversation

cpufreq: pmac32-cpufreq: Fix refcount leak bug

PATCH Applied Liang He 2 participants 2 messages Jun 18, 2022 – Jun 20, 2022

Subsystems (2)
lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH 1/1 cpufreq: pmac32-cpufreq: Fix refcount leak bug

In pmac_cpufreq_init_MacRISC3(), we need to add corresponding of_node_put() for the three node pointers whose refcount have been incremented by of_find_node_by_name().

---
 drivers/cpufreq/pmac32-cpufreq.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/cpufreq/pmac32-cpufreq.c +4 -0
index 20f64a8b0a35..4b8ee2014da6 100644
@@ -470,6 +470,10 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode)
 	if (slew_done_gpio_np)
 		slew_done_gpio = read_gpio(slew_done_gpio_np);
 
+	of_node_put(volt_gpio_np);
+	of_node_put(freq_gpio_np);
+	of_node_put(slew_done_gpio_np);
+
 	/* If we use the frequency GPIOs, calculate the min/max speeds based
 	 * on the bus frequencies
 	 */
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 14 lines · Liang He

In pmac_cpufreq_init_MacRISC3(), we need to add corresponding of_node_put() for the three node pointers whose refcount have been incremented by of_find_node_by_name().

---
 drivers/cpufreq/pmac32-cpufreq.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/cpufreq/pmac32-cpufreq.c +0 -0
index 20f64a8b0a35..4b8ee2014da6 100644

drivers/cpufreq/pmac32-cpufreq.c static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode) · line 479

Quoted 10 lines
drivers/cpufreq/pmac32-cpufreq.c +4 -0
@@ -470,6 +470,10 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode)
 	if (slew_done_gpio_np)
 		slew_done_gpio = read_gpio(slew_done_gpio_np);
 
+	of_node_put(volt_gpio_np);
+	of_node_put(freq_gpio_np);
+	of_node_put(slew_done_gpio_np);
+
 	/* If we use the frequency GPIOs, calculate the min/max speeds based
 	 * on the bus frequencies
 	 */

Applied. Thanks.

Signature · 1 line
viresh