w1: w1_therm: Fix conversion result for negative temperatures
authorIvan Zaentsev <ivan.zaentsev@wirenboard.ru>
Thu, 21 Jan 2021 09:30:21 +0000 (12:30 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Jan 2021 13:59:16 +0000 (14:59 +0100)
commit2f6055c26f1913763eabc66c7c27d0693561e966
tree84fd692bced8187050502677b844771f85aea088
parent2c104a469a4ce276117acda94ccf922c3b82d735
w1: w1_therm: Fix conversion result for negative temperatures

DS18B20 device driver returns an incorrect value for negative temperatures
due to a missing sign-extension in w1_DS18B20_convert_temp().

Fix by using s16 temperature value when converting to int.

Fixes: 9ace0b4dab1c (w1: w1_therm: Add support for GXCAS GX20MH01 device.)
Cc: stable <stable@vger.kernel.org>
Reported-by: Paweł Marciniak <sunwire@gmail.com>
Signed-off-by: Ivan Zaentsev <ivan.zaentsev@wirenboard.ru>
Link: https://lore.kernel.org/r/20210121093021.224764-1-ivan.zaentsev@wirenboard.ru
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/w1/slaves/w1_therm.c