Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[linux-2.6-block.git] / drivers / thermal / of-thermal.c
index d8ec44b194d64a012c1dff1472c233f83f1119b0..b8e509c60848e4f94dc621185d334b59f8151c1a 100644 (file)
@@ -331,6 +331,14 @@ static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip,
        if (trip >= data->ntrips || trip < 0)
                return -EDOM;
 
+       if (data->ops->set_trip_temp) {
+               int ret;
+
+               ret = data->ops->set_trip_temp(data->sensor_data, trip, temp);
+               if (ret)
+                       return ret;
+       }
+
        /* thermal framework should take care of data->mask & (1 << trip) */
        data->trips[trip].temperature = temp;
 
@@ -906,7 +914,7 @@ finish:
        return tz;
 
 free_tbps:
-       for (i = 0; i < tz->num_tbps; i++)
+       for (i = i - 1; i >= 0; i--)
                of_node_put(tz->tbps[i].cooling_device);
        kfree(tz->tbps);
 free_trips: