summaryrefslogtreecommitdiff
path: root/rust
diff options
context:
space:
mode:
authorMurad Masimov <m.masimov@maxima.ru>2024-12-16 20:36:48 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-12-27 14:02:12 +0100
commit0f289ba4e5ae2ff81c8954ab2bd371082cb8eddc (patch)
tree13c7bf7b4589a3918c1fba952febf5aedb11f796 /rust
parent62721d74829ebc0577382a64470342764642f6a8 (diff)
downloadlinux-0f289ba4e5ae2ff81c8954ab2bd371082cb8eddc.tar.gz
linux-0f289ba4e5ae2ff81c8954ab2bd371082cb8eddc.tar.bz2
linux-0f289ba4e5ae2ff81c8954ab2bd371082cb8eddc.zip
hwmon: (tmp513) Fix interpretation of values of Temperature Result and Limit Registers
[ Upstream commit dd471e25770e7e632f736b90db1e2080b2171668 ] The values returned by the driver after processing the contents of the Temperature Result and the Temperature Limit Registers do not correspond to the TMP512/TMP513 specifications. A raw register value is converted to a signed integer value by a sign extension in accordance with the algorithm provided in the specification, but due to the off-by-one error in the sign bit index, the result is incorrect. According to the TMP512 and TMP513 datasheets, the Temperature Result (08h to 0Bh) and Limit (11h to 14h) Registers are 13-bit two's complement integer values, shifted left by 3 bits. The value is scaled by 0.0625 degrees Celsius per bit. E.g., if regval = 1 1110 0111 0000 000, the output should be -25 degrees, but the driver will return +487 degrees. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 59dfa75e5d82 ("hwmon: Add driver for Texas Instruments TMP512/513 sensor chips.") Signed-off-by: Murad Masimov <m.masimov@maxima.ru> Link: https://lore.kernel.org/r/20241216173648.526-4-m.masimov@maxima.ru [groeck: fixed description line length] Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'rust')
0 files changed, 0 insertions, 0 deletions