Skip to content

Commit

Permalink
hwmon: (k10temp) Only apply temperature offset if result is positive
Browse files Browse the repository at this point in the history
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: 1b50b77 ("hwmon: (k10temp) Add support for temperature offsets")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
  • Loading branch information
Guenter Roeck committed Feb 12, 2018
1 parent 7928b2c commit aef17ca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/hwmon/k10temp.c
Original file line number Diff line number Diff line change
@@ -129,7 +129,10 @@ static ssize_t temp1_input_show(struct device *dev,

data->read_tempreg(data->pdev, &regval);
temp = (regval >> 21) * 125;
temp -= data->temp_offset;
if (temp > data->temp_offset)
temp -= data->temp_offset;
else
temp = 0;

return sprintf(buf, "%u\n", temp);
}

0 comments on commit aef17ca

Please sign in to comment.