Messages in this thread | | | Subject | Re: [1/1] w1: w1 temp calculation overflow fix. | From | Harvey Harrison <> | Date | Mon, 09 Feb 2009 13:48:44 -0800 |
| |
On Tue, 2009-02-10 at 00:42 +0300, Evgeniy Polyakov wrote: > Signed-off-by: Ian Dall <ian@beware.dropbear.id.au> > Signed-off-by: Evgeniy Polyakov <zbr@ioremap.net> > > diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c > index 2c8dff9..1ed3d55 100644 > --- a/drivers/w1/slaves/w1_therm.c > +++ b/drivers/w1/slaves/w1_therm.c > @@ -115,7 +115,7 @@ static struct w1_therm_family_converter w1_therm_families[] = { > > static inline int w1_DS18B20_convert_temp(u8 rom[9]) > { > - s16 t = (rom[1] << 8) | rom[0]; > + int t = ((s16)rom[1] << 8) | rom[0];
Alternatively,
int t = (s16)le16_to_cpup((__le16 *)rom);
Cheers,
Harvey
| |