Skip to content

Commit dc6c76c

Browse files
Tony O'BrienAlone0316
Tony O'Brien
authored andcommitted
hwmon: (adt7475) Fix masking of hysteresis registers
[ Upstream commit 48e8186870d9d0902e712d601ccb7098cb220688 ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 4788828 commit dc6c76c

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
@@ -480,10 +480,10 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *attr,
480480
val = (temp - val) / 1000;
481481

482482
if (sattr->index != 1) {
483-
data->temp[HYSTERSIS][sattr->index] &= 0xF0;
483+
data->temp[HYSTERSIS][sattr->index] &= 0x0F;
484484
data->temp[HYSTERSIS][sattr->index] |= (val & 0xF) << 4;
485485
} else {
486-
data->temp[HYSTERSIS][sattr->index] &= 0x0F;
486+
data->temp[HYSTERSIS][sattr->index] &= 0xF0;
487487
data->temp[HYSTERSIS][sattr->index] |= (val & 0xF);
488488
}
489489

0 commit comments

Comments
 (0)