Skip to content

Commit 89cf480

Browse files
rafaeljwnvidia-bfigg
authored andcommitted
thermal: core: Drop excessive lockdep_assert_held() calls
BugLink: https://bugs.launchpad.net/bugs/2042697 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]> (cherry picked from commit b57841f) Acked-by: Jamie Nguyen <[email protected]> Acked-by: Brad Figg <[email protected]> Acked-by: Ian May <[email protected]> Acked-by: Jacob Martin <[email protected]>
1 parent d7f80ef commit 89cf480

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
@@ -923,8 +923,6 @@ static void cooling_device_stats_setup(struct thermal_cooling_device *cdev)
923923
unsigned long states = cdev->max_state + 1;
924924
int var;
925925

926-
lockdep_assert_held(&cdev->lock);
927-
928926
var = sizeof(*stats);
929927
var += sizeof(*stats->time_in_state) * states;
930928
var += sizeof(*stats->trans_table) * states * states;
@@ -950,8 +948,6 @@ static void cooling_device_stats_setup(struct thermal_cooling_device *cdev)
950948

951949
static void cooling_device_stats_destroy(struct thermal_cooling_device *cdev)
952950
{
953-
lockdep_assert_held(&cdev->lock);
954-
955951
kfree(cdev->stats);
956952
cdev->stats = NULL;
957953
}
@@ -978,6 +974,8 @@ void thermal_cooling_device_destroy_sysfs(struct thermal_cooling_device *cdev)
978974

979975
void thermal_cooling_device_stats_reinit(struct thermal_cooling_device *cdev)
980976
{
977+
lockdep_assert_held(&cdev->lock);
978+
981979
cooling_device_stats_destroy(cdev);
982980
cooling_device_stats_setup(cdev);
983981
}

0 commit comments

Comments
 (0)