thermal: clean the coverity errors of thermal module
authorzhiqiang.liang <zhiqiang.liang@amlogic.com>
Tue, 21 Aug 2018 08:53:08 +0000 (16:53 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Tue, 21 Aug 2018 11:38:04 +0000 (04:38 -0700)
PD#166793: code defects in thermal part

Change-Id: Icd970eced2ed3bcd76a8baf15bf7b885d63d8d6a
Signed-off-by: zhiqiang.liang <zhiqiang.liang@amlogic.com>
drivers/amlogic/thermal/cpucore_cooling.c
drivers/amlogic/thermal/gpu_cooling.c
drivers/amlogic/thermal/gpucore_cooling.c

index 58055c232a70a00e402c26945c171c858e248f64..0c67c32c4e61b39ae9aa330162d0538e9dd1e0a3 100644 (file)
@@ -197,7 +197,8 @@ static int cpucore_notify_state(struct thermal_cooling_device *cdev,
                                struct thermal_zone_device *tz,
                                enum thermal_trip_type type)
 {
-       unsigned long cur_state, ins_upper;
+       unsigned long  ins_upper;
+       long cur_state;
        long upper = -1;
        int i;
 
index cabcb8860b76c8339fed980ac8a7a0b41a6cd8fc..6d9fe358fc20da1d5f6d6b980665ae48bef2d9a5 100644 (file)
@@ -157,7 +157,7 @@ static int gpufreq_set_cur_state(struct thermal_cooling_device *cdev,
 
        pr_debug("state=%ld,gpufreq_device->gpufreq_state=%d\n",
                 state, gpufreq_device->gpufreq_state);
-       if (state >= 0 && state <= max_state) {
+       if (state <= max_state) {
                if (gpufreq_device->set_gpu_freq_idx)
                        gpufreq_device->set_gpu_freq_idx((unsigned int)state);
        }
index fd378441c1cae3260aa6f2c09e27374497c5af86..5cbffa4c7d268b426034c8f5eb77a709aa7a1d6d 100644 (file)
@@ -209,7 +209,8 @@ static int gpucore_notify_state(struct thermal_cooling_device *cdev,
                                struct thermal_zone_device *tz,
                                enum thermal_trip_type type)
 {
-       unsigned long cur_state, ins_upper;
+       unsigned long ins_upper;
+       long cur_state;
        long upper = -1;
        int i;