Skip to content

Commit

Permalink
cpufreq: ti: Fix 'of_node_put' being called twice in error handling path
Browse files Browse the repository at this point in the history
If 'dev_pm_opp_set_supported_hw()' fails, 'opp_data->opp_node' refcount
will be decremented 2 times.
One, just a few lines above, and another one in the error handling path.

Fix it by simply moving the 'of_node_put' call of the normal path.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Christophe Jaillet authored and Rafael J. Wysocki committed Aug 24, 2017
1 parent d79d148 commit 9a6e91d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/cpufreq/ti-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,6 @@ static int ti_cpufreq_init(void)
if (ret)
goto fail_put_node;

of_node_put(opp_data->opp_node);

ret = PTR_ERR_OR_ZERO(dev_pm_opp_set_supported_hw(opp_data->cpu_dev,
version, VERSION_COUNT));
if (ret) {
Expand All @@ -255,6 +253,8 @@ static int ti_cpufreq_init(void)
goto fail_put_node;
}

of_node_put(opp_data->opp_node);

register_cpufreq_dt:
platform_device_register_simple("cpufreq-dt", -1, NULL, 0);

Expand Down

0 comments on commit 9a6e91d

Please sign in to comment.