Skip to content

Commit dec4038

Browse files
Tony O'BrienSasha Levin
authored andcommitted
hwmon: (adt7475) Fix masking of hysteresis registers
[ Upstream commit 48e8186 ] 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 <tony.obrien@alliedtelesis.co.nz> Link: https://lore.kernel.org/r/20230222005228.158661-3-tony.obrien@alliedtelesis.co.nz Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 02ac470 commit dec4038

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

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

0 commit comments

Comments
 (0)