cpufreq: Typecast compared integers
Antti P Miettinen [Tue, 20 Mar 2012 11:50:50 +0000 (13:50 +0200)]
The min/max frequencies in cpufreq_policy are unsigned integers
but pm_qos_request() returns a signed int. Compare as unsigned,
frequencies are never negative.

Bug 949219

Change-Id: Iba0de9ad6bf221f7a2e5560f597aa56cbeb7b6f6
Signed-off-by: Antti P Miettinen <amiettinen@nvidia.com>
Reviewed-on: http://git-master/r/91214
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>

drivers/cpufreq/cpufreq.c

index a764703..96adadf 100644 (file)
@@ -1633,10 +1633,14 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data,
                                struct cpufreq_policy *policy)
 {
        int ret = 0;
+       unsigned int qmin, qmax;
        unsigned int pmin = policy->min;
        unsigned int pmax = policy->max;
-       unsigned int qmin = min(pm_qos_request(PM_QOS_CPU_FREQ_MIN), data->max);
-       unsigned int qmax = max(pm_qos_request(PM_QOS_CPU_FREQ_MAX), data->min);
+
+       qmin = min((unsigned int)pm_qos_request(PM_QOS_CPU_FREQ_MIN),
+                  data->max);
+       qmax = max((unsigned int)pm_qos_request(PM_QOS_CPU_FREQ_MAX),
+                  data->min);
 
        pr_debug("setting new policy for CPU %u: %u - %u (%u - %u) kHz\n",
                policy->cpu, pmin, pmax, qmin, qmax);