* [PATCH] thermal: cpu_cooling: fix return value check in cpufreq_cooling_register()
@ 2013-10-25 13:55 Wei Yongjun
2013-11-06 5:17 ` Zhang Rui
0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2013-10-25 13:55 UTC (permalink / raw)
To: rui.zhang, eduardo.valentin; +Cc: yongjun_wei, linux-pm
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
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>
---
drivers/thermal/cpu_cooling.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
index d179028..02a46f2 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;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] thermal: cpu_cooling: fix return value check in cpufreq_cooling_register()
2013-10-25 13:55 [PATCH] thermal: cpu_cooling: fix return value check in cpufreq_cooling_register() Wei Yongjun
@ 2013-11-06 5:17 ` Zhang Rui
0 siblings, 0 replies; 2+ messages in thread
From: Zhang Rui @ 2013-11-06 5:17 UTC (permalink / raw)
To: Wei Yongjun; +Cc: eduardo.valentin, yongjun_wei, linux-pm
On Fri, 2013-10-25 at 21:55 +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> 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>
applied.
thanks,
rui
> ---
> drivers/thermal/cpu_cooling.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
> index d179028..02a46f2 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;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-11-06 5:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-25 13:55 [PATCH] thermal: cpu_cooling: fix return value check in cpufreq_cooling_register() Wei Yongjun
2013-11-06 5:17 ` Zhang Rui
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).