===================================================================
@@ -1001,7 +1001,7 @@ __thermal_cooling_device_register(struct
ret = cdev->ops->get_cur_state(cdev, ¤t_state);
if (ret)
- goto out_cdev_type;
+ current_state = ULONG_MAX;
thermal_cooling_device_setup_sysfs(cdev);
@@ -1016,7 +1016,8 @@ __thermal_cooling_device_register(struct
return ERR_PTR(ret);
}
- thermal_debug_cdev_add(cdev, current_state);
+ if (current_state <= cdev->max_state)
+ thermal_debug_cdev_add(cdev, current_state);
/* Add 'this' new cdev to the global cdev list */
mutex_lock(&thermal_list_lock);