OSDN Git Service

Merge tag 'balancenuma-v11' of git://git.kernel.org/pub/scm/linux/kernel/git/mel...
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / drivers / thermal / thermal_sys.c
index a69f24c..8c8ce80 100644 (file)
@@ -252,8 +252,8 @@ static void bind_cdev(struct thermal_cooling_device *cdev)
                }
 
                tzp = pos->tzp;
-               if (!tzp->tbp)
-                       return;
+               if (!tzp || !tzp->tbp)
+                       continue;
 
                for (i = 0; i < tzp->num_tbps; i++) {
                        if (tzp->tbp[i].cdev || !tzp->tbp[i].match)
@@ -289,7 +289,7 @@ static void bind_tz(struct thermal_zone_device *tz)
                goto exit;
        }
 
-       if (!tzp->tbp)
+       if (!tzp || !tzp->tbp)
                goto exit;
 
        list_for_each_entry(pos, &thermal_cdev_list, node) {
@@ -336,7 +336,8 @@ static void monitor_thermal_zone(struct thermal_zone_device *tz)
 static void handle_non_critical_trips(struct thermal_zone_device *tz,
                        int trip, enum thermal_trip_type trip_type)
 {
-       tz->governor->throttle(tz, trip);
+       if (tz->governor)
+               tz->governor->throttle(tz, trip);
 }
 
 static void handle_critical_trips(struct thermal_zone_device *tz,
@@ -387,12 +388,13 @@ static void update_temperature(struct thermal_zone_device *tz)
        ret = tz->ops->get_temp(tz, &temp);
        if (ret) {
                pr_warn("failed to read out thermal zone %d\n", tz->id);
-               return;
+               goto exit;
        }
 
        tz->last_temperature = tz->temperature;
        tz->temperature = temp;
 
+exit:
        mutex_unlock(&tz->lock);
 }