Patch "hwmon: (f71882fg) Fix negative temperature" has been added to the 4.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    hwmon: (f71882fg) Fix negative temperature

to the 4.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     hwmon-f71882fg-fix-negative-temperature.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 86911354a087a3cfa559a0eb55fb01f065d65f9d
Author: Ji-Ze Hong (Peter Hong) <hpeter@xxxxxxxxx>
Date:   Mon Apr 18 17:07:06 2022 +0800

    hwmon: (f71882fg) Fix negative temperature
    
    [ Upstream commit 4aaaaf0f279836f06d3b9d0ffeec7a1e1a04ceef ]
    
    All temperature of Fintek superio hwmonitor that using 1-byte reg will use
    2's complement.
    
    In show_temp()
            temp = data->temp[nr] * 1000;
    
    When data->temp[nr] read as 255, it indicate -1C, but this code will report
    255C to userspace. It'll be ok when change to:
            temp = ((s8)data->temp[nr]) * 1000;
    
    Signed-off-by: Ji-Ze Hong (Peter Hong) <hpeter+linux_kernel@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20220418090706.6339-1-hpeter+linux_kernel@xxxxxxxxx
    Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
index cb28e4b4fb10..b87ca56fb774 100644
--- a/drivers/hwmon/f71882fg.c
+++ b/drivers/hwmon/f71882fg.c
@@ -1590,8 +1590,9 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,
 		temp *= 125;
 		if (sign)
 			temp -= 128000;
-	} else
-		temp = data->temp[nr] * 1000;
+	} else {
+		temp = ((s8)data->temp[nr]) * 1000;
+	}
 
 	return sprintf(buf, "%d\n", temp);
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux