]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/w1/slaves/w1_therm.c
w1: w1 temp calculation overflow fix
[karo-tx-linux.git] / drivers / w1 / slaves / w1_therm.c
index 2c8dff9f77da13396b0d02207e15d486ddbd5d4e..1ed3d554e3728a1f7b6fb51501b1df52d26f514d 100644 (file)
@@ -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];
        t = t*1000/16;
        return t;
 }