The idle_inject_register() function returns NULL on error, it never returns error pointers. Fixes: 1e044f70e5c2 ("thermal/drivers/cpu_cooling: Introduce the cpu idle cooling driver") Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> --- drivers/thermal/cpuidle_cooling.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/cpuidle_cooling.c b/drivers/thermal/cpuidle_cooling.c index 6d778acefeec..ab48387ce868 100644 --- a/drivers/thermal/cpuidle_cooling.c +++ b/drivers/thermal/cpuidle_cooling.c @@ -187,8 +187,8 @@ __init cpuidle_of_cooling_register(struct device_node *np, } ii_dev = idle_inject_register(drv->cpumask); - if (IS_ERR(ii_dev)) { - ret = PTR_ERR(ii_dev); + if (!ii_dev) { + ret = -ENOMEM; goto out_id; } -- 2.11.0