c
#include <stdatomic.h>

void thermal_debug_tz_remove(struct thermal_zone_device *tz)
{
    if (!tz)
        return;

    struct thermal_debugfs *thermal_dbg = atomic_exchange(&tz->debugfs, NULL);
    if (!thermal_dbg)
        return;

    mutex_lock(&thermal_dbg->lock);
    // ... rest of the function (omit line 10)
}
