--- drivers/thermal/thermal_core.c | 2 +- drivers/thermal/thermal_core.h | 1 + drivers/thermal/thermal_sysfs.c | 7 ++++++- 3 files changed, 8 insertions(+), 2 deletions(-) --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -353,7 +353,7 @@ thermal_zone_device_set_polling(tz, tz->polling_delay_jiffies); } -static struct thermal_governor *thermal_get_tz_governor(struct thermal_zone_device *tz) +struct thermal_governor *thermal_get_tz_governor(struct thermal_zone_device *tz) { if (tz->governor) return tz->governor; --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -262,6 +262,7 @@ void __thermal_zone_device_update(struct thermal_zone_device *tz, enum thermal_notify_event event); void thermal_zone_device_critical_reboot(struct thermal_zone_device *tz); +struct thermal_governor *thermal_get_tz_governor(struct thermal_zone_device *tz); void thermal_governor_update_tz(struct thermal_zone_device *tz, enum thermal_notify_event reason); --- a/drivers/thermal/thermal_sysfs.c +++ b/drivers/thermal/thermal_sysfs.c @@ -209,8 +209,13 @@ policy_show(struct device *dev, struct device_attribute *devattr, char *buf) { struct thermal_zone_device *tz = to_thermal_zone(dev); + struct thermal_governor *governor; - return sprintf(buf, "%s\n", tz->governor->name); + guard(thermal_zone)(tz); + + governor = thermal_get_tz_governor(tz); + + return sprintf(buf, "%s\n", governor->name); } static ssize_t