diff options
author | Lucas Stach <l.stach@pengutronix.de> | 2014-09-26 09:33:46 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-10-03 09:40:55 -0400 |
commit | f9739d27059d8fd7b64096ea7251608628b5bd30 (patch) | |
tree | 6ffd2145d88465afd95bb8b66449add8a5f21d29 | |
parent | bbcf071969b20f356877c8067986be0a2dcaa2aa (diff) |
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: 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>
-rw-r--r-- | drivers/cpufreq/cpufreq-dt.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index e00265066a75..6bbb8b913446 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c | |||
@@ -259,7 +259,6 @@ static int cpufreq_init(struct cpufreq_policy *policy) | |||
259 | else | 259 | else |
260 | priv->cdev = cdev; | 260 | priv->cdev = cdev; |
261 | } | 261 | } |
262 | of_node_put(np); | ||
263 | 262 | ||
264 | priv->cpu_dev = cpu_dev; | 263 | priv->cpu_dev = cpu_dev; |
265 | priv->cpu_reg = cpu_reg; | 264 | priv->cpu_reg = cpu_reg; |
@@ -270,6 +269,8 @@ static int cpufreq_init(struct cpufreq_policy *policy) | |||
270 | if (ret) | 269 | if (ret) |
271 | goto out_cooling_unregister; | 270 | goto out_cooling_unregister; |
272 | 271 | ||
272 | of_node_put(np); | ||
273 | |||
273 | return 0; | 274 | return 0; |
274 | 275 | ||
275 | out_cooling_unregister: | 276 | out_cooling_unregister: |