diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2014-02-07 02:44:10 -0800 |
---|---|---|
committer | Diwakar Tundlam <dtundlam@nvidia.com> | 2014-02-13 16:08:14 -0800 |
commit | 8876723da6599117622f527f50d9edb5b055ef8a (patch) | |
tree | 9fc1f0f3d95332fe52976509d332f3e8fd29e984 /drivers/thermal | |
parent | ff826a0dc6e6f360cacddfd0f3c73ab37ba4f28d (diff) |
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().
Change-Id: I9fc197c47184cc8681392b31d4c2fb87bcf8b461
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Paul Walmsley <pwalmsley@nvidia.com> # for the NVIDIA downstream kernel
Reviewed-on: http://git-master/r/356891
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
Tested-by: Diwakar Tundlam <dtundlam@nvidia.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/cpu_cooling.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index d17902886c3f..02a46f23d14c 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -469,10 +469,10 @@ cpufreq_cooling_register(const struct cpumask *clip_cpus) cool_dev = thermal_cooling_device_register(dev_name, cpufreq_dev, &cpufreq_cooling_ops); - if (!cool_dev) { + if (IS_ERR(cool_dev)) { release_idr(&cpufreq_idr, cpufreq_dev->id); kfree(cpufreq_dev); - return ERR_PTR(-EINVAL); + return cool_dev; } cpufreq_dev->cool_dev = cool_dev; cpufreq_dev->cpufreq_state = 0; |