[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210319202424.890968-1-daniel.lezcano@linaro.org>
Date: Fri, 19 Mar 2021 21:24:23 +0100
From: Daniel Lezcano <daniel.lezcano@...aro.org>
To: daniel.lezcano@...aro.org
Cc: kernel test robot <lkp@...el.com>,
Dan Carpenter <dan.carpenter@...cle.com>,
Zhang Rui <rui.zhang@...el.com>,
Amit Kucheria <amitk@...nel.org>,
linux-pm@...r.kernel.org (open list:THERMAL),
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH] 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 <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@...aro.org>
---
drivers/thermal/devfreq_cooling.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
--
2.25.1
Powered by blists - more mailing lists