Skip to content

Commit 48e8186

Browse files
Tony O'Briengroeck
authored andcommitted
hwmon: (adt7475) Fix masking of hysteresis registers
The wrong bits are masked in the hysteresis register; indices 0 and 2 should zero bits [7:4] and preserve bits [3:0], and index 1 should zero bits [3:0] and preserve bits [7:4]. Fixes: 1c301fc ("hwmon: Add a driver for the ADT7475 hardware monitoring chip") Signed-off-by: Tony O'Brien <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 5f8d1e3 commit 48e8186

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/hwmon/adt7475.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,10 +488,10 @@ static ssize_t temp_store(struct device *dev, struct device_attribute *attr,
488488
val = (temp - val) / 1000;
489489

490490
if (sattr->index != 1) {
491-
data->temp[HYSTERSIS][sattr->index] &= 0xF0;
491+
data->temp[HYSTERSIS][sattr->index] &= 0x0F;
492492
data->temp[HYSTERSIS][sattr->index] |= (val & 0xF) << 4;
493493
} else {
494-
data->temp[HYSTERSIS][sattr->index] &= 0x0F;
494+
data->temp[HYSTERSIS][sattr->index] &= 0xF0;
495495
data->temp[HYSTERSIS][sattr->index] |= (val & 0xF);
496496
}
497497

0 commit comments

Comments
 (0)