path: root/drivers/thermal
diff options
authorDaniel Lezcano <>2021-03-19 21:24:23 +0100
committerDaniel Lezcano <>2021-04-15 13:21:16 +0200
commit9aa80ab2c0ba67ce3281aee604b543293f71390d (patch)
treec7878d5c646710d8f9be06b580eb9a809f175695 /drivers/thermal
parentd44616c6cc3e35eea03ecfe9040edfa2b486a059 (diff)
thermal/drivers/devfreq_cooling: Fix wrong return on error path
The following error is reported by kbuild: smatch warnings: drivers/thermal/devfreq_cooling.c:433 of_devfreq_cooling_register_power() warn: passing zero to 'ERR_PTR' Fix the error code by the setting the 'err' variable instead of 'cdev'. Fixes: f8d354e821b2 ("thermal/drivers/devfreq_cooling: Use device name instead of auto-numbering") Reported-by: kernel test robot <> Reported-by: Dan Carpenter <> Signed-off-by: Daniel Lezcano <> Link:
Diffstat (limited to 'drivers/thermal')
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/thermal/devfreq_cooling.c b/drivers/thermal/devfreq_cooling.c
index fb250ac16f50..3a788ac4f525 100644
--- a/drivers/thermal/devfreq_cooling.c
+++ b/drivers/thermal/devfreq_cooling.c
@@ -402,7 +402,7 @@ of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
if (err < 0)
goto free_table;
- cdev = ERR_PTR(-ENOMEM);
+ err = -ENOMEM;
name = kasprintf(GFP_KERNEL, "devfreq-%s", dev_name(dev));
if (!name)
goto remove_qos_req;