[PATCH 5.15 435/917] thermal/core: fix a UAF bug in __thermal_cooling_device_register()