diff mbox series

cpufreq: pmac32-cpufreq: Fix refcount leak bug

Message ID 20220618022545.4056299-1-windhl@126.com
State Accepted
Commit ccd7567d4b6cf187fdfa55f003a9e461ee629e36
Headers show
Series cpufreq: pmac32-cpufreq: Fix refcount leak bug | expand

Commit Message

Liang He June 18, 2022, 2:25 a.m. UTC
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().

Signed-off-by: Liang He <windhl@126.com>
---
 drivers/cpufreq/pmac32-cpufreq.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Viresh Kumar June 20, 2022, 4:42 a.m. UTC | #1
On 18-06-22, 10:25, Liang He wrote:
> 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().
> 
> Signed-off-by: Liang He <windhl@126.com>
> ---
>  drivers/cpufreq/pmac32-cpufreq.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c
> index 20f64a8b0a35..4b8ee2014da6 100644
> --- a/drivers/cpufreq/pmac32-cpufreq.c
> +++ b/drivers/cpufreq/pmac32-cpufreq.c
> @@ -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.
diff mbox series

Patch

diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c
index 20f64a8b0a35..4b8ee2014da6 100644
--- a/drivers/cpufreq/pmac32-cpufreq.c
+++ b/drivers/cpufreq/pmac32-cpufreq.c
@@ -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
 	 */