From: sashiko-bot@kernel.org
To: "Jerome Tollet" <jerome.tollet@gmail.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v6 2/3] hwmon: it87: prepare for extended PWM temp maps
Date: Sat, 29 Aug 2026 21:14:42 +0000 [thread overview]
Message-ID: <20260829211442.D28291F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260829210036.61136-3-jerome.tollet@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] it87_check_pwm corrupts the PWM control register on newer controllers when fixing broken BIOS polarity.
- [High] User-configured temperature mappings are silently discarded when switching legacy controllers to automatic PWM mode.
--
commit e4890144d7762af5309a78a9545773b57261f124
Author: benoit.masson <yahoo@perenite.com>
hwmon: it87: prepare for extended PWM temp maps
Introduce helper logic for PWM-to-temperature mappings so newer register
layouts can be supported while retaining the legacy two groups of three
temperature sources.
> diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
> index 1af815b5d33a9..980e425fcc28b 100644
> --- a/drivers/hwmon/it87.c
> +++ b/drivers/hwmon/it87.c
[ ... ]
> @@ -1635,27 +1748,30 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr,
[ ... ]
> } else {
> u8 ctrl;
>
> if (has_newer_autopwm(data)) {
> - ctrl = (data->pwm_ctrl[nr] & 0x7c) |
> - data->pwm_temp_map[nr];
> + ctrl = pwm_temp_map_set(data,
> + data->pwm_ctrl[nr] & ~0x80,
> + data->pwm_temp_map[nr]);
> if (val != 1)
> ctrl |= 0x80;
> } else {
> ctrl = (val == 1 ? data->pwm_duty[nr] : 0x80);
> }
> data->pwm_ctrl[nr] = ctrl;
> - it87_write_value(data, IT87_REG_PWM[nr], ctrl);
> + it87_write_value(data, it87_reg_pwm(data, nr), ctrl);
[Severity: High]
This is a pre-existing issue, but does switching legacy controllers to
automatic pwm mode permanently wipe out the user's deferred temperature
mapping?
When set_pwm_enable() executes the legacy controller branch for automatic
mode (when val is 2), it unconditionally sets ctrl to 0x80. Writing this
value to the pwm control register clears bits 0-1, which discards any
user-configured temperature mappings previously deferred in
data->pwm_temp_map[nr]. Can this logic error lead to fans monitoring the
wrong temperature sensor (defaulting to 0) and potentially causing
hardware overheating?
[ ... ]
> @@ -3493,7 +3596,8 @@ static int it87_check_pwm(struct device *dev)
[ ... ]
> if (!((pwm[0] | pwm[1] | pwm[2]) & 0x80)) {
> dev_info(dev,
> "Reconfiguring PWM to active high polarity\n");
> it87_write_value(data, IT87_REG_FAN_CTL,
> tmp | 0x87);
> for (i = 0; i < 3; i++)
> it87_write_value(data,
> - IT87_REG_PWM[i],
> + it87_reg_pwm(data,
> + i),
> 0x7f & ~pwm[i]);
[Severity: High]
This isn't a bug introduced by this patch, but does this write corrupt
the temperature mapping on newer controllers?
When fixing broken BIOS polarity in it87_check_pwm(), writing 0x7f & ~pwm[i]
inverts the manual duty cycle bits for older controllers. However, on newer
controllers the duty cycle is in a separate register, and the pwm control
register instead holds the temperature mapping. Does inverting these bits
corrupt the temperature mapping and cause incorrect fan behavior?
> return 1;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260829210036.61136-1-jerome.tollet@gmail.com?part=2
next prev parent reply other threads:[~2026-08-29 21:14 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-29 17:05 [PATCH v5 0/4] hwmon: it87: add IT8613E support Jerome Tollet
2026-08-29 17:05 ` [PATCH v5 1/4] hwmon: it87: describe per-chip temperature resources Jerome Tollet
2026-08-29 17:20 ` sashiko-bot
2026-08-29 17:05 ` [PATCH v5 2/4] hwmon: it87: prepare for extended PWM temp maps Jerome Tollet
2026-08-29 17:20 ` sashiko-bot
2026-08-29 17:05 ` [PATCH v5 3/4] hwmon: it87: expose additional temperature limits Jerome Tollet
2026-08-29 17:17 ` sashiko-bot
2026-08-29 17:05 ` [PATCH v5 4/4] hwmon: it87: add IT8613E support Jerome Tollet
2026-08-29 17:23 ` sashiko-bot
2026-08-29 21:00 ` [PATCH v6 0/3] " Jerome Tollet
2026-08-29 21:00 ` [PATCH v6 1/3] hwmon: it87: describe per-chip temperature resources Jerome Tollet
2026-08-29 21:17 ` sashiko-bot
2026-08-29 21:00 ` [PATCH v6 2/3] hwmon: it87: prepare for extended PWM temp maps Jerome Tollet
2026-08-29 21:14 ` sashiko-bot [this message]
2026-08-29 21:00 ` [PATCH v6 3/3] hwmon: it87: add IT8613E support Jerome Tollet
2026-08-29 21:15 ` sashiko-bot
2026-08-29 22:01 ` [PATCH v7 0/3] " Jerome Tollet
2026-08-29 22:01 ` [PATCH v7 1/3] hwmon: it87: describe per-chip PWM temperature maps Jerome Tollet
2026-08-29 22:08 ` sashiko-bot
2026-08-30 0:01 ` Guenter Roeck
2026-08-29 22:01 ` [PATCH v7 2/3] hwmon: it87: prepare for extended PWM temp maps Jerome Tollet
2026-08-29 22:14 ` sashiko-bot
2026-08-30 0:01 ` Guenter Roeck
2026-08-29 22:01 ` [PATCH v7 3/3] hwmon: it87: add IT8613E support Jerome Tollet
2026-08-29 22:11 ` sashiko-bot
2026-08-30 0:02 ` Guenter Roeck
2026-08-29 22:53 ` [PATCH v6 0/3] " Guenter Roeck
2026-08-30 5:19 ` Jerome Tollet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260829211442.D28291F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=jerome.tollet@gmail.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox