mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-02-17 22:49:02 +00:00
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>
This commit is contained in:
parent
9a6c80b0cf
commit
7d85f1dc5c
1 changed files with 1 additions and 1 deletions
|
@ -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];
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue