Skip to content

Commit b57841f

Browse files
committed
thermal: core: Drop excessive lockdep_assert_held() calls
The lockdep_assert_held() calls added to cooling_device_stats_setup() and cooling_device_stats_destroy() by commit 790930f ("thermal: core: Introduce thermal_cooling_device_update()") trigger false-positive lockdep reports in code paths that are not subject to race conditions (before cooling device registration and after cooling device removal). For this reason, remove the lockdep_assert_held() calls from both cooling_device_stats_setup() and cooling_device_stats_destroy() and add one to thermal_cooling_device_stats_reinit() that has to be called under the cdev lock. Fixes: 790930f ("thermal: core: Introduce thermal_cooling_device_update()") Link: https://lore.kernel.org/linux-acpi/[email protected] Reported-by: Imre Deak <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 197b6b6 commit b57841f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/thermal/thermal_sysfs.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -876,8 +876,6 @@ static void cooling_device_stats_setup(struct thermal_cooling_device *cdev)
876876
unsigned long states = cdev->max_state + 1;
877877
int var;
878878

879-
lockdep_assert_held(&cdev->lock);
880-
881879
var = sizeof(*stats);
882880
var += sizeof(*stats->time_in_state) * states;
883881
var += sizeof(*stats->trans_table) * states * states;
@@ -903,8 +901,6 @@ static void cooling_device_stats_setup(struct thermal_cooling_device *cdev)
903901

904902
static void cooling_device_stats_destroy(struct thermal_cooling_device *cdev)
905903
{
906-
lockdep_assert_held(&cdev->lock);
907-
908904
kfree(cdev->stats);
909905
cdev->stats = NULL;
910906
}
@@ -931,6 +927,8 @@ void thermal_cooling_device_destroy_sysfs(struct thermal_cooling_device *cdev)
931927

932928
void thermal_cooling_device_stats_reinit(struct thermal_cooling_device *cdev)
933929
{
930+
lockdep_assert_held(&cdev->lock);
931+
934932
cooling_device_stats_destroy(cdev);
935933
cooling_device_stats_setup(cdev);
936934
}

0 commit comments

Comments
 (0)