]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
hwmon: (tps23861) Fix reporting of negative temperatures
authorMurad Masimov <m.masimov@maxima.ru>
Thu, 21 Nov 2024 17:36:03 +0000 (20:36 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:51:07 +0000 (19:51 +0100)
commitfb71f1788624599130a1497c5c26542045b3f47c
treeaee22a47ebd5000e8c739d774ced81aa6ce9e616
parentb6a394fe4c6bed03641a989b2099e747c5521692
hwmon: (tps23861) Fix reporting of negative temperatures

[ Upstream commit de2bf507fabba9c0c678cf5ed54beb546f5ca29a ]

Negative temperatures are reported as large positive temperatures
due to missing sign extension from unsigned int to long. Cast unsigned
raw register values to signed before performing the calculations
to fix the problem.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: fff7b8ab2255 ("hwmon: add Texas Instruments TPS23861 driver")
Signed-off-by: Murad Masimov <m.masimov@maxima.ru>
Message-ID: <20241121173604.2021-1-m.masimov@maxima.ru>
[groeck: Updated subject and description]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hwmon/tps23861.c