diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2013-10-25 09:55:42 -0400 |
---|---|---|
committer | Zhang Rui <rui.zhang@intel.com> | 2013-11-06 00:16:49 -0500 |
commit | 73b9bcd76d13716cc0e0ab053f8c1ae41f47636e (patch) | |
tree | f35e989f059b5846d845045f9945bcf9d01a992c /drivers/thermal/cpu_cooling.c | |
parent | 732e4c8db99cb3125bd6865794ec8e3a998c4d6e (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().
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Diffstat (limited to 'drivers/thermal/cpu_cooling.c')
-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) | |||
469 | 469 | ||
470 | cool_dev = thermal_cooling_device_register(dev_name, cpufreq_dev, | 470 | cool_dev = thermal_cooling_device_register(dev_name, cpufreq_dev, |
471 | &cpufreq_cooling_ops); | 471 | &cpufreq_cooling_ops); |
472 | if (!cool_dev) { | 472 | if (IS_ERR(cool_dev)) { |
473 | release_idr(&cpufreq_idr, cpufreq_dev->id); | 473 | release_idr(&cpufreq_idr, cpufreq_dev->id); |
474 | kfree(cpufreq_dev); | 474 | kfree(cpufreq_dev); |
475 | return ERR_PTR(-EINVAL); | 475 | return cool_dev; |
476 | } | 476 | } |
477 | cpufreq_dev->cool_dev = cool_dev; | 477 | cpufreq_dev->cool_dev = cool_dev; |
478 | cpufreq_dev->cpufreq_state = 0; | 478 | cpufreq_dev->cpufreq_state = 0; |