[PATCH v3 1/3] cpufreq: Use int type to store negative error codes

Qianfeng Rong posted 3 patches 1 month ago
[PATCH v3 1/3] cpufreq: Use int type to store negative error codes
Posted by Qianfeng Rong 1 month ago
Change the 'ret' variable in store_scaling_setspeed() from unsigned int to
int, as it needs to store either negative error codes or zero returned
by kstrtouint().

No effect on runtime.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
 drivers/cpufreq/cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index a615c98d80ca..f47096683abb 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -914,7 +914,7 @@ static ssize_t store_scaling_setspeed(struct cpufreq_policy *policy,
 					const char *buf, size_t count)
 {
 	unsigned int freq = 0;
-	unsigned int ret;
+	int ret;
 
 	if (!policy->governor || !policy->governor->store_setspeed)
 		return -EINVAL;
-- 
2.34.1
Re: [PATCH v3 1/3] cpufreq: Use int type to store negative error codes
Posted by Viresh Kumar 1 month ago
On 02-09-25, 19:45, Qianfeng Rong wrote:
> Change the 'ret' variable in store_scaling_setspeed() from unsigned int to
> int, as it needs to store either negative error codes or zero returned
> by kstrtouint().
> 
> No effect on runtime.
> 
> Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
> ---
>  drivers/cpufreq/cpufreq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh