Skip to content

Commit 662f920

Browse files
committed
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: d0df264 ("thermal/core: Remove pointless thermal_zone_device_reset() function") Signed-off-by: Rafael J. Wysocki <[email protected]> Link: https://patch.msgid.link/[email protected] Reviewed-by: Lukasz Luba <[email protected]>
1 parent 85ee944 commit 662f920

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/thermal/thermal_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1467,6 +1467,7 @@ thermal_zone_device_register_with_trips(const char *type,
14671467
thermal_zone_destroy_device_groups(tz);
14681468
goto remove_id;
14691469
}
1470+
thermal_zone_device_init(tz);
14701471
result = device_register(&tz->device);
14711472
if (result)
14721473
goto release_device;
@@ -1509,7 +1510,6 @@ thermal_zone_device_register_with_trips(const char *type,
15091510

15101511
mutex_unlock(&thermal_list_lock);
15111512

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

0 commit comments

Comments
 (0)