diff mbox

[1/2] cpufreq: exynos: Fix unsigned variable being checked for negative value

Message ID 1358932932-14094-1-git-send-email-sachin.kamat@linaro.org
State Accepted
Headers show

Commit Message

Sachin Kamat Jan. 23, 2013, 9:22 a.m. UTC
exynos_cpufreq_scale function returns signed value which was
assigned to an unsigned variable and checked for negative value which
is always false. Hence make it signed.

Fixes the following smatch warnings:
drivers/cpufreq/exynos-cpufreq.c:83 exynos_cpufreq_scale() warn:
unsigned 'old_index' is never less than zero.
drivers/cpufreq/exynos-cpufreq.c:89 exynos_cpufreq_scale() warn:
unsigned 'index' is never less than zero.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
Rafael J. Wysocki suggested these 2 patches be taken through the
Samsung tree.
---
 drivers/cpufreq/exynos-cpufreq.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Kukjin Kim Jan. 25, 2013, 6:24 p.m. UTC | #1
Sachin Kamat wrote:
> 
> exynos_cpufreq_scale function returns signed value which was
> assigned to an unsigned variable and checked for negative value which
> is always false. Hence make it signed.
> 
> Fixes the following smatch warnings:
> drivers/cpufreq/exynos-cpufreq.c:83 exynos_cpufreq_scale() warn:
> unsigned 'old_index' is never less than zero.
> drivers/cpufreq/exynos-cpufreq.c:89 exynos_cpufreq_scale() warn:
> unsigned 'index' is never less than zero.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
> Rafael J. Wysocki suggested these 2 patches be taken through the
> Samsung tree.
> ---
>  drivers/cpufreq/exynos-cpufreq.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
Looks OK to me, applied.

Thanks.

- Kukjin
diff mbox

Patch

diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c
index 218b3ce..88401ba 100644
--- a/drivers/cpufreq/exynos-cpufreq.c
+++ b/drivers/cpufreq/exynos-cpufreq.c
@@ -65,7 +65,7 @@  static int exynos_cpufreq_scale(unsigned int target_freq)
 	struct cpufreq_policy *policy = cpufreq_cpu_get(0);
 	unsigned int arm_volt, safe_arm_volt = 0;
 	unsigned int mpll_freq_khz = exynos_info->mpll_freq_khz;
-	unsigned int index, old_index;
+	int index, old_index;
 	int ret = 0;
 
 	freqs.old = policy->cur;