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 58055c2..0c67c32 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 cabcb88..6d9fe35 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 fd37844..5cbffa4 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;