]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media:pci:mgb4: Fixed negative hwmon temperatures processing
authorMartin Tůma <martin.tuma@digiteqautomotive.com>
Fri, 23 Jan 2026 12:14:58 +0000 (13:14 +0100)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Mon, 16 Mar 2026 10:51:55 +0000 (11:51 +0100)
The "magic" temperature formula must be computed using a signed integer for
negative temperatures to work properly.

Signed-off-by: Martin Tůma <martin.tuma@digiteqautomotive.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/pci/mgb4/mgb4_core.c

index a7351a469386316ce4ee86cc79db6344ce5a1656..d23d854581c5f92d93d172a4e6d096a57712ae2a 100644 (file)
@@ -84,7 +84,8 @@ static int temp_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
                     int channel, long *val)
 {
        struct mgb4_dev *mgbdev = dev_get_drvdata(dev);
-       u32 val10, raw;
+       u32 raw;
+       int val10;
 
        if (type != hwmon_temp || attr != hwmon_temp_input)
                return -EOPNOTSUPP;