cpufreq: fix sign check of an unsigned variable in cpufreq-cpu0
PATCH 1/1 cpufreq: fix sign check of an unsigned variable in cpufreq-cpu0
A "< 0" test for an unsigned variable is meaningless, change the variable to signed.
---
stable?
drivers/cpufreq/cpufreq-cpu0.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/cpufreq/cpufreq-cpu0.c +2 -1
@@ -44,7 +44,8 @@ static int cpu0_set_target(struct cpufreq_policy *policy, {struct cpufreq_freqs freqs;struct opp *opp; -unsigned long freq_Hz, volt =0 , volt_old =0 , tol =0 ; +unsigned long volt =0 , volt_old =0 , tol =0 ; +long freq_Hz;unsigned int index, cpu;int ret;
Signature · 1 line
1.7.2.5
Quoted 16 lines · Guennadi Liakhovetski
A "< 0" test for an unsigned variable is meaningless, change the variable to signed.
Signed-off-by Guennadi Liakhovetski <[email protected]>---
stable?
drivers/cpufreq/cpufreq-cpu0.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)drivers/cpufreq/cpufreq-cpu0.c +0
-0
drivers/cpufreq/cpufreq-cpu0.c static int cpu0_set_target(struct cpufreq_policy *policy, · line 48
Quoted 6 lines
drivers/cpufreq/cpufreq-cpu0.c +2
-1@@ -44,7 +44,8 @@ static int cpu0_set_target(struct cpufreq_policy *policy, {struct cpufreq_freqs freqs;struct opp *opp; -unsigned long freq_Hz, volt =0 , volt_old =0 , tol =0 ; +unsigned long volt =0 , volt_old =0 , tol =0 ; +long freq_Hz;
The disease is spread across a bigger region though.
@Mike: clk_round_rate returns long and __clk_round_rate returns unsigned long and clk_ops->round_rate returns long again.. Don't you see something strange here?
Quoting Viresh Kumar (2013-02-25 04:09:47)
Quoted 27 lines
Quoted 16 lines · Guennadi Liakhovetski
A "< 0" test for an unsigned variable is meaningless, change the variable to signed.
Signed-off-by Guennadi Liakhovetski <[email protected]>---
stable?
drivers/cpufreq/cpufreq-cpu0.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)drivers/cpufreq/cpufreq-cpu0.c +0
-0drivers/cpufreq/cpufreq-cpu0.c static int cpu0_set_target(struct cpufreq_policy *policy, · line 48
Quoted 6 lines
drivers/cpufreq/cpufreq-cpu0.c +2
-1@@ -44,7 +44,8 @@ static int cpu0_set_target(struct cpufreq_policy *policy, {struct cpufreq_freqs freqs;struct opp *opp; -unsigned long freq_Hz, volt =0 , volt_old =0 , tol =0 ; +unsigned long volt =0 , volt_old =0 , tol =0 ; +long freq_Hz;Acked-by Viresh Kumar <[email protected]>
Quoted 5 lines
The disease is spread across a bigger region though.
@Mike:
clk_round_ratereturns long and__clk_round_ratereturns unsigned long andclk_ops->round_ratereturns long again.. Don't you see something strange here?
Yes, this is in my todo list. I have a branch with some relevant changes but I haven't posted it yet.
Regards,
Mike