diff options
author | Guenter Roeck <linux@roeck-us.net> | 2018-02-07 20:49:39 -0500 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2018-02-12 17:23:29 -0500 |
commit | aef17ca1271948ee57cc39b2493d31110cc42625 (patch) | |
tree | e1cebfb6a7d6c71f0e0539864129dcdbb2569468 | |
parent | 7928b2cbe55b2a410a0f5c1f154610059c57b1b2 (diff) |
hwmon: (k10temp) Only apply temperature offset if result is positive
A user reports a really bad temperature on Ryzen 1950X.
k10temp-pci-00cb
Adapter: PCI adapter
temp1: +4294948.3°C (high = +70.0°C)
This will happen if the temperature reported by the chip is lower than
the offset temperature. This has been seen in the field if "Sense MI Skew"
and/or "Sense MI Offset" BIOS parameters were set to unexpected values.
Let's report a temperature of 0 degrees C in that case.
Fixes: 1b50b776355f ("hwmon: (k10temp) Add support for temperature offsets")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r-- | drivers/hwmon/k10temp.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c index 06b4e1c78bd8..4c6594a4661d 100644 --- a/drivers/hwmon/k10temp.c +++ b/drivers/hwmon/k10temp.c | |||
@@ -129,7 +129,10 @@ static ssize_t temp1_input_show(struct device *dev, | |||
129 | 129 | ||
130 | data->read_tempreg(data->pdev, ®val); | 130 | data->read_tempreg(data->pdev, ®val); |
131 | temp = (regval >> 21) * 125; | 131 | temp = (regval >> 21) * 125; |
132 | temp -= data->temp_offset; | 132 | if (temp > data->temp_offset) |
133 | temp -= data->temp_offset; | ||
134 | else | ||
135 | temp = 0; | ||
133 | 136 | ||
134 | return sprintf(buf, "%u\n", temp); | 137 | return sprintf(buf, "%u\n", temp); |
135 | } | 138 | } |