From: Guenter Roeck Date: Sat, 9 Nov 2013 17:38:14 +0000 (-0800) Subject: hwmon: (coretemp) Refine TjMax detection X-Git-Tag: firefly_0821_release~176^2~4655^2~7 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9fb6c9c73b11bef65ba80a362547fd116c1e1c9d;p=firefly-linux-kernel-4.4.55.git hwmon: (coretemp) Refine TjMax detection Intel's turbostat code uses only 7 bits from MSR_IA32_TEMPERATURE_TARGET to read TjMax, and also only accepts it if the reported temperature is at least 85 degrees C. Play safe and do the same. Signed-off-by: Guenter Roeck --- diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 7eed10e20b38..b2e59b395ce4 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c @@ -368,12 +368,12 @@ static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev) if (cpu_has_tjmax(c)) dev_warn(dev, "Unable to read TjMax from CPU %u\n", id); } else { - val = (eax >> 16) & 0xff; + val = (eax >> 16) & 0x7f; /* * If the TjMax is not plausible, an assumption * will be used */ - if (val) { + if (val >= 85) { dev_dbg(dev, "TjMax is %d degrees C\n", val); return val * 1000; }