7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ridham Khurana [ Upstream commit f58c16056f8585ebafb0f1f5d90c23085443a4b9 ] temp_from_reg_signed() uses only the high byte when the sign bit is set and drops the fractional bits in the low byte. Writing -500 to temp2_offset stores 0xff80 (-0.5 degrees C) in the offset registers, but reading temp2_offset back returns -1000. Negative temp1_input and temp2_input values are rounded down to the next whole degree the same way. The chip reports -0.125 degrees C as 0xffe0, which the driver returns as -1000. Treat the register pair as a single 16-bit two's complement value. Fixes: fffd80ccc1e6 ("hwmon: LM95245 driver") Cc: stable@vger.kernel.org Signed-off-by: Ridham Khurana Link: https://patch.msgid.link/20260923172551.1593798-1-khurana.ridham222@gmail.com Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin --- drivers/hwmon/lm95245.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/lm95245.c b/drivers/hwmon/lm95245.c index 11553391f54b1..925574b8b0ca4 100644 --- a/drivers/hwmon/lm95245.c +++ b/drivers/hwmon/lm95245.c @@ -96,9 +96,9 @@ static int temp_from_reg_unsigned(u8 val_h, u8 val_l) static int temp_from_reg_signed(u8 val_h, u8 val_l) { - if (val_h & 0x80) - return (val_h - 0x100) * 1000; - return temp_from_reg_unsigned(val_h, val_l); + s16 val_hl = (val_h << 8) | val_l; + + return val_hl * 1000 / 256; } static int lm95245_read_conversion_rate(struct lm95245_data *data) -- 2.53.0