Commit 73b9bcd7 authored by Wei Yongjun's avatar Wei Yongjun Committed by Zhang Rui

thermal: cpu_cooling: fix return value check in cpufreq_cooling_register()

In case of error, the function thermal_cooling_device_register() returns
ERR_PTR() and never returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().
Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
parent 732e4c8d
...@@ -469,10 +469,10 @@ cpufreq_cooling_register(const struct cpumask *clip_cpus) ...@@ -469,10 +469,10 @@ cpufreq_cooling_register(const struct cpumask *clip_cpus)
cool_dev = thermal_cooling_device_register(dev_name, cpufreq_dev, cool_dev = thermal_cooling_device_register(dev_name, cpufreq_dev,
&cpufreq_cooling_ops); &cpufreq_cooling_ops);
if (!cool_dev) { if (IS_ERR(cool_dev)) {
release_idr(&cpufreq_idr, cpufreq_dev->id); release_idr(&cpufreq_idr, cpufreq_dev->id);
kfree(cpufreq_dev); kfree(cpufreq_dev);
return ERR_PTR(-EINVAL); return cool_dev;
} }
cpufreq_dev->cool_dev = cool_dev; cpufreq_dev->cool_dev = cool_dev;
cpufreq_dev->cpufreq_state = 0; cpufreq_dev->cpufreq_state = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment