Commit 662f920f authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

thermal: core: Initialize thermal zones before registering them



Since user space can start interacting with a new thermal zone as soon
as device_register() called by thermal_zone_device_register_with_trips()
returns, it is better to initialize the thermal zone before calling
device_register() on it.

Fixes: d0df264f ("thermal/core: Remove pointless thermal_zone_device_reset() function")
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/3336146.44csPzL39Z@rjwysocki.net


Reviewed-by: default avatarLukasz Luba <lukasz.luba@arm.com>
parent 85ee9449
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1467,6 +1467,7 @@ thermal_zone_device_register_with_trips(const char *type,
		thermal_zone_destroy_device_groups(tz);
		goto remove_id;
	}
	thermal_zone_device_init(tz);
	result = device_register(&tz->device);
	if (result)
		goto release_device;
@@ -1509,7 +1510,6 @@ thermal_zone_device_register_with_trips(const char *type,

	mutex_unlock(&thermal_list_lock);

	thermal_zone_device_init(tz);
	/* Update the new thermal zone and mark it as already updated. */
	if (atomic_cmpxchg(&tz->need_update, 1, 0))
		thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);