[COMMON] thermal: gpu_cooling: Fix SVACE defect
authorHyeonseong Gil <hs.gil@samsung.com>
Tue, 7 Feb 2017 09:43:21 +0000 (18:43 +0900)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:18:26 +0000 (17:18 +0900)
WGID: 95803, 96347, 96467

Resolved migration conflicts from kernel 4.9 to 4.14.
- rename gpufreq_device -> gpufreq_cdev

Change-Id: Id875f7bee04ab164098e82842662a550ce63b2df
Signed-off-by: Hyeonseong Gil <hs.gil@samsung.com>
drivers/thermal/gpu_cooling.c

index 56a8edb11799838e762d2599158e542fd4690066..935c033f07a0a658589e20d1dc570e3e6ef54944 100644 (file)
@@ -211,7 +211,7 @@ static int get_property(unsigned int gpu, unsigned long input,
 
                if (property == GET_LEVEL && (unsigned int)input == freq) {
                        /* get level by frequency */
-                       *output = descend ? i : (max_level - i);
+                       *output = (unsigned int)(descend ? i : (max_level - i));
                        return 0;
                }
                if (property == GET_FREQ && level == i) {
@@ -296,7 +296,7 @@ static int build_dyn_power_table(struct gpufreq_cooling_device *gpufreq_cdev,
                power = (u64)capacitance * freq * voltage_mv * voltage_mv;
                do_div(power, 1000000000);
 
-               power_table[i].frequency = freq;
+               power_table[i].frequency = (unsigned int)freq;
 
                /* power is stored in mW */
                power_table[i].power = power;
@@ -394,6 +394,7 @@ static int lookup_static_power(struct gpufreq_cooling_device *gpufreq_cdev,
                unsigned long voltage, int temperature, u32 *power)
 {
        int volt_index = 0, temp_index = 0;
+       int index = 0;
 
        voltage = voltage / 1000;
        temperature  = temperature / 1000;
@@ -424,7 +425,8 @@ static int lookup_static_power(struct gpufreq_cooling_device *gpufreq_cdev,
        if (temp_index > gpufreq_cdev->var_temp_size)
                temp_index = gpufreq_cdev->var_temp_size;
 
-       *power = (unsigned int)gpufreq_cdev->var_table[volt_index * (gpufreq_cdev->var_temp_size + 1) + temp_index];
+       index = (int)(volt_index * (gpufreq_cdev->var_temp_size + 1) + temp_index);
+       *power = (unsigned int)gpufreq_cdev->var_table[index];
 
        return 0;
 }