From 7d85f1dc5cf1269ecb41de983c29386e6cddf910 Mon Sep 17 00:00:00 2001 From: Jeff Dischler Date: Wed, 29 Sep 2010 13:46:19 -0500 Subject: [PATCH] ds1621: Fix negative temperature readings Fix bug where signed data was processed as unsigned. The bug previously resulted in negative temperature readings wrapping around, eg -10 became 245. Signed-off-by: Jeff Dischler Signed-off-by: Peter Tyser --- drivers/hwmon/ds1621.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index 60bf50203a..5a2ea62899 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c @@ -80,7 +80,7 @@ int dtt_read(int sensor, int reg) /* Handle 2 byte result */ if (dlen == 2) - return ((int)((short)data[1] + (((short)data[0]) << 8))); + return (short)((data[0] << 8) | data[1]); return (int)data[0]; } -- 2.39.5