Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[cascardo/linux.git] / drivers / thermal / thermal_core.c
index 19edd61..f1d511a 100644 (file)
@@ -247,10 +247,11 @@ static void bind_cdev(struct thermal_cooling_device *cdev)
                if (!pos->tzp && !pos->ops->bind)
                        continue;
 
-               if (!pos->tzp && pos->ops->bind) {
+               if (pos->ops->bind) {
                        ret = pos->ops->bind(pos, cdev);
                        if (ret)
                                print_bind_err_msg(pos, cdev, ret);
+                       continue;
                }
 
                tzp = pos->tzp;
@@ -282,8 +283,8 @@ static void bind_tz(struct thermal_zone_device *tz)
 
        mutex_lock(&thermal_list_lock);
 
-       /* If there is no platform data, try to use ops->bind */
-       if (!tzp && tz->ops->bind) {
+       /* If there is ops->bind, try to use ops->bind */
+       if (tz->ops->bind) {
                list_for_each_entry(pos, &thermal_cdev_list, node) {
                        ret = tz->ops->bind(tz, pos);
                        if (ret)
@@ -1038,7 +1039,8 @@ static void thermal_release(struct device *dev)
                     sizeof("thermal_zone") - 1)) {
                tz = to_thermal_zone(dev);
                kfree(tz);
-       } else {
+       } else if(!strncmp(dev_name(dev), "cooling_device",
+                       sizeof("cooling_device") - 1)){
                cdev = to_cooling_device(dev);
                kfree(cdev);
        }