]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
cpufreq: cpufreq-dt: fix potential double put of cpu OF node
authorLucas Stach <l.stach@pengutronix.de>
Fri, 26 Sep 2014 13:33:46 +0000 (15:33 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 3 Oct 2014 13:40:55 +0000 (15:40 +0200)
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: d2f31f1da54f "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>
drivers/cpufreq/cpufreq-dt.c

index e00265066a758e76d4051742526b8ffc3a278a9e..6bbb8b913446bf4ce7131c4fb9448db2ac7721c3 100644 (file)
@@ -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: