Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f9739d27 authored by Lucas Stach's avatar Lucas Stach Committed by Rafael J. Wysocki
Browse files

cpufreq: cpufreq-dt: fix potential double put of cpu OF node



If cpufreq_generic_init() fails we jump into the resource
cleanup path which contains a of_node_put() call. Another
instance of this has already been called at that time
resulting a double decrement of the refcount.

Fix this by calling of_node_put() only after we are sure
that nothing has gone wrong.

Fixes: d2f31f1d "cpufreq: cpu0: Move per-cluster initialization code to ->init()"
Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent bbcf0719
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -259,7 +259,6 @@ static int cpufreq_init(struct cpufreq_policy *policy)
		else
			priv->cdev = cdev;
	}
	of_node_put(np);

	priv->cpu_dev = cpu_dev;
	priv->cpu_reg = cpu_reg;
@@ -270,6 +269,8 @@ static int cpufreq_init(struct cpufreq_policy *policy)
	if (ret)
		goto out_cooling_unregister;

	of_node_put(np);

	return 0;

out_cooling_unregister: