Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpufreq: ti: Fix 'of_node_put' being called twice in error handling path

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>

authored by

Christophe Jaillet and committed by
Rafael J. Wysocki
9a6e91d0 d79d148b

+2 -2
+2 -2
drivers/cpufreq/ti-cpufreq.c
··· 245 245 if (ret) 246 246 goto fail_put_node; 247 247 248 - of_node_put(opp_data->opp_node); 249 - 250 248 ret = PTR_ERR_OR_ZERO(dev_pm_opp_set_supported_hw(opp_data->cpu_dev, 251 249 version, VERSION_COUNT)); 252 250 if (ret) { ··· 252 254 "Failed to set supported hardware\n"); 253 255 goto fail_put_node; 254 256 } 257 + 258 + of_node_put(opp_data->opp_node); 255 259 256 260 register_cpufreq_dt: 257 261 platform_device_register_simple("cpufreq-dt", -1, NULL, 0);