
< 	cdev->debugfs = NULL;
< 
< 	mutex_unlock(&thermal_dbg->lock);
< 
< 	thermal_debugfs_remove_id(thermal_dbg);
---
> 	int perform_remove = (cdev->debugfs != NULL);
> 	cdev->debugfs = NULL;
> 
> 	mutex_unlock(&thermal_dbg->lock);
> 
> 	if (perform_remove)
> 		thermal_debugfs_remove_id(thermal_dbg);
