[PATCH 5.14 434/849] thermal/core: fix a UAF bug in __thermal_cooling_device_register()