Skip to content

Commit 668e020

Browse files
Lan Tianyurafaeljw
Lan Tianyu
authored andcommitted
ACPI / thermal: Add check of "_TZD" availability and evaluating result
Some machines don't provide _TZD, so check the availability of it before carrying out futher operations. If _TZD is present, also check the result of its evaluation. [rjw: Changelog] Signed-off-by: Lan Tianyu <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 7702ae0 commit 668e020

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/acpi/thermal.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -485,14 +485,14 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
485485
break;
486486
}
487487

488-
if (flag & ACPI_TRIPS_DEVICES) {
489-
memset(&devices, 0, sizeof(struct acpi_handle_list));
488+
if ((flag & ACPI_TRIPS_DEVICES)
489+
&& acpi_has_method(tz->device->handle, "_TZD")) {
490+
memset(&devices, 0, sizeof(devices));
490491
status = acpi_evaluate_reference(tz->device->handle, "_TZD",
491492
NULL, &devices);
492-
if (memcmp(&tz->devices, &devices,
493-
sizeof(struct acpi_handle_list))) {
494-
memcpy(&tz->devices, &devices,
495-
sizeof(struct acpi_handle_list));
493+
if (ACPI_SUCCESS(status)
494+
&& memcmp(&tz->devices, &devices, sizeof(devices))) {
495+
tz->devices = devices;
496496
ACPI_THERMAL_TRIPS_EXCEPTION(flag, "device");
497497
}
498498
}

0 commit comments

Comments
 (0)