c
void thermal_debug_cdev_remove(struct thermal_cooling_device *cdev) {
    if (cdev && cdev->debugfs) { // Check both pointers
        struct thermal_debugfs *thermal_dbg = cdev->debugfs;
        // ... rest of your code, now safe to use thermal_dbg ...
    } else {
        // Handle the error gracefully. Log a message, 
        // return an error code, or take appropriate action. 
    } 
}
