aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJeff Dischler <jdischler@xes-inc.com>2010-09-29 13:46:19 -0500
committerWolfgang Denk <wd@denx.de>2010-10-06 23:01:22 +0200
commit7d85f1dc5cf1269ecb41de983c29386e6cddf910 (patch)
tree276f6863ac94d1e34309b497cd0a65219e2778c5 /drivers
parent9a6c80b0cfca744816e8ee55fcf5d7d55da09cbd (diff)
downloadu-boot-7d85f1dc5cf1269ecb41de983c29386e6cddf910.zip
u-boot-7d85f1dc5cf1269ecb41de983c29386e6cddf910.tar.gz
u-boot-7d85f1dc5cf1269ecb41de983c29386e6cddf910.tar.bz2
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 <jdischler@xes-inc.com> Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hwmon/ds1621.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c
index 60bf502..5a2ea62 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];
}