mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-24 19:40:21 +09:00
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: f8d354e821 ("thermal/drivers/devfreq_cooling: Use device name instead of auto-numbering")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20210319202424.890968-1-daniel.lezcano@linaro.org
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user