Skip to content

Commit 7b2fd27

Browse files
ChiaYuShihgroeck
authored andcommitted
hwmon: (nct7904) Fix incorrect range of temperature limit registers
The format of temperature limitation registers are 8-bit 2's complement and the range is -128~127. Converts the reading value to signed char to fix the incorrect range of temperature limitation registers. Signed-off-by: Amy Shih <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
1 parent 6d44e43 commit 7b2fd27

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/hwmon/nct7904.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ static int nct7904_read_temp(struct device *dev, u32 attr, int channel,
362362
struct nct7904_data *data = dev_get_drvdata(dev);
363363
int ret, temp;
364364
unsigned int reg1, reg2, reg3;
365+
s8 temps;
365366

366367
switch (attr) {
367368
case hwmon_temp_input:
@@ -467,7 +468,8 @@ static int nct7904_read_temp(struct device *dev, u32 attr, int channel,
467468

468469
if (ret < 0)
469470
return ret;
470-
*val = ret * 1000;
471+
temps = ret;
472+
*val = temps * 1000;
471473
return 0;
472474
}
473475

0 commit comments

Comments
 (0)