[PATCH] media:pci:mgb4: Fixed negative hwmon temperatures processing

tumic@gpxsee.org posted 1 patch 2 weeks ago
drivers/media/pci/mgb4/mgb4_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] media:pci:mgb4: Fixed negative hwmon temperatures processing
Posted by tumic@gpxsee.org 2 weeks ago
From: Martin Tůma <martin.tuma@digiteqautomotive.com>

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>
---
 drivers/media/pci/mgb4/mgb4_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/mgb4/mgb4_core.c b/drivers/media/pci/mgb4/mgb4_core.c
index a7cb8dc50b53..0fd6c1c95abc 100644
--- a/drivers/media/pci/mgb4/mgb4_core.c
+++ b/drivers/media/pci/mgb4/mgb4_core.c
@@ -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;

base-commit: eb4ee870747c3a77a9c3c84d84efb64bd481013a
-- 
2.52.0