Skip to content

Commit 2477098

Browse files
committed
Merge tag 'hwmon-for-v6.16-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon fixes from Guenter Roeck: - ltc4282: Avoid repeated register write operation - occ: Fix unaligned accesses, and rework attribute registration to reduce stack usage - ftsteutates: Fix TOCTOU race * tag 'hwmon-for-v6.16-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (ltc4282) avoid repeated register write hwmon: (occ) fix unaligned accesses hwmon: (occ) Rework attribute registration for stack usage hwmon: (ftsteutates) Fix TOCTOU race in fts_read()
2 parents fb4d33a + c25892b commit 2477098

File tree

3 files changed

+104
-152
lines changed

3 files changed

+104
-152
lines changed

drivers/hwmon/ftsteutates.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,13 +423,16 @@ static int fts_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
423423
break;
424424
case hwmon_pwm:
425425
switch (attr) {
426-
case hwmon_pwm_auto_channels_temp:
427-
if (data->fan_source[channel] == FTS_FAN_SOURCE_INVALID)
426+
case hwmon_pwm_auto_channels_temp: {
427+
u8 fan_source = data->fan_source[channel];
428+
429+
if (fan_source == FTS_FAN_SOURCE_INVALID || fan_source >= BITS_PER_LONG)
428430
*val = 0;
429431
else
430-
*val = BIT(data->fan_source[channel]);
432+
*val = BIT(fan_source);
431433

432434
return 0;
435+
}
433436
default:
434437
break;
435438
}

drivers/hwmon/ltc4282.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,13 +1511,6 @@ static int ltc4282_setup(struct ltc4282_state *st, struct device *dev)
15111511
return ret;
15121512
}
15131513

1514-
if (device_property_read_bool(dev, "adi,fault-log-enable")) {
1515-
ret = regmap_set_bits(st->map, LTC4282_ADC_CTRL,
1516-
LTC4282_FAULT_LOG_EN_MASK);
1517-
if (ret)
1518-
return ret;
1519-
}
1520-
15211514
if (device_property_read_bool(dev, "adi,fault-log-enable")) {
15221515
ret = regmap_set_bits(st->map, LTC4282_ADC_CTRL, LTC4282_FAULT_LOG_EN_MASK);
15231516
if (ret)

0 commit comments

Comments
 (0)