thermal: int340x: Prevent error in reading trip hysteresis attribute
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Sat, 26 May 2018 01:10:10 +0000 (18:10 -0700)
committerZhang Rui <rui.zhang@intel.com>
Wed, 30 May 2018 06:22:26 +0000 (14:22 +0800)
Some of the INT340X devices may not have hysteresis defined in the ACPI
definition. In that case reading trip hysteresis results in error. This
spams logs of user space utilities.

In this case instead of returning error, just return hysteresis as 0,
which is correct as there is no hysteresis defined for the device.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
drivers/thermal/int340x_thermal/int340x_thermal_zone.c

index 145a5c53ff5c0fd16c579352124394ece156c0eb..dfdf6dbc2ddcd67cc07868f5bdd0ec209386f20a 100644 (file)
@@ -147,9 +147,9 @@ static int int340x_thermal_get_trip_hyst(struct thermal_zone_device *zone,
 
        status = acpi_evaluate_integer(d->adev->handle, "GTSH", NULL, &hyst);
        if (ACPI_FAILURE(status))
-               return -EIO;
-
-       *temp = hyst * 100;
+               *temp = 0;
+       else
+               *temp = hyst * 100;
 
        return 0;
 }