Skip to content

Commit

Permalink
cpufreq: cpufreq-dt: fix potential double put of cpu OF node
Browse files Browse the repository at this point in the history
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: d2f31f1 "cpufreq: cpu0: Move per-cluster initialization code to ->init()"
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Lucas Stach authored and Rafael J. Wysocki committed Oct 3, 2014
1 parent bbcf071 commit f9739d2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/cpufreq/cpufreq-dt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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:
Expand Down

0 comments on commit f9739d2

Please sign in to comment.