From: sashiko-bot@kernel.org
To: "Luiz Angelo Daros de Luca" <luizluca@gmail.com>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org,
linux-hwmon@vger.kernel.org
Subject: Re: [PATCH 2/4] hwmon: (adt7470) Add ADT7470_PWM_MAX macro
Date: Thu, 16 Jul 2026 21:32:52 +0000 [thread overview]
Message-ID: <20260716213252.EACA71F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260716-adt7470_thermalzone-v1-2-cc55ef35edde@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] I2C error during adt7470_read_temperatures() leaves fans permanently stuck in manual mode
- [High] Unbounded sysfs values for auto_update_interval and num_temp_sensors cause a tight loop and I2C bus flooding
--
--- Patch [2]: [PATCH 2/4] hwmon: (adt7470) Add ADT7470_PWM_MAX macro ---
commit 176c7576aebc83ec3b52518b957109a401b37ada
Author: Luiz Angelo Daros de Luca <luizluca@gmail.com>
hwmon: (adt7470) Add ADT7470_PWM_MAX macro
Instead of a magic 255, use a macro to refer to it.
> diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
> index 664349756dc2b..4ac292cd7f47e 100644
> --- a/drivers/hwmon/adt7470.c
> +++ b/drivers/hwmon/adt7470.c
> @@ -100,6 +100,7 @@ static const unsigned short normal_i2c[] = { 0x2C, 0x2E, 0x2F, I2C_CLIENT_END };
> #define ADT7470_REG_FAN_MAX(x) (ADT7470_REG_FAN_MAX_BASE_ADDR + ((x) * 2))
>
> #define ADT7470_PWM_COUNT 4
> +#define ADT7470_PWM_MAX 255
> #define ADT7470_REG_PWM(x) (ADT7470_REG_PWM_BASE_ADDR + (x))
> #define ADT7470_REG_PWM_MAX(x) (ADT7470_REG_PWM_MAX_BASE_ADDR + (x))
> #define ADT7470_REG_PWM_MIN(x) (ADT7470_REG_PWM_MIN_BASE_ADDR + (x))
[ ... ]
[Severity: High]
This is a pre-existing issue, but could an I2C error during
adt7470_read_temperatures() leave the fans permanently stuck in manual mode?
If there is a transient I2C bus error (e.g., NACK) during
adt7470_read_temperatures() when updating ADT7470_REG_PWM_CFG(2) or
resetting ADT7470_T05_STB_MASK, it looks like it returns immediately:
drivers/hwmon/adt7470.c:adt7470_read_temperatures() {
...
err = regmap_update_bits(data->regmap, ADT7470_REG_PWM_CFG(2),
ADT7470_PWM_AUTO_MASK, 0);
if (err < 0)
return err;
...
}
If the function returns here, does it fail to restore PWM_CFG(0) back from
manual mode?
On the next iteration of the periodic kthread, might the driver read this
corrupted manual mode as the original state, permanently locking the fans
in manual mode?
[Severity: High]
This is a pre-existing issue, but does an unbounded sysfs value for
auto_update_interval and num_temp_sensors cause a tight loop and I2C bus
flooding?
When setting the auto_update_interval, the value is allowed to be 0:
drivers/hwmon/adt7470.c:auto_update_interval_store() {
...
temp = clamp_val(temp, 0, 60000);
mutex_lock(&data->lock);
data->auto_update_interval = temp;
...
}
If auto_update_interval is set to 0, does the background thread spin without
delay?
drivers/hwmon/adt7470.c:adt7470_update_thread() {
...
schedule_timeout_interruptible(msecs_to_jiffies(data->auto_update_interval));
...
}
If both auto_update_interval and num_temp_sensors are 0, does this create a
busy-loop of I2C bus transactions?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260716-adt7470_thermalzone-v1-0-cc55ef35edde@gmail.com?part=2
next prev parent reply other threads:[~2026-07-16 21:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 21:21 [PATCH 0/4] hwmon: (adt7470) Add thermal framework support Luiz Angelo Daros de Luca
2026-07-16 21:21 ` [PATCH 1/4] dt-bindings: hwmon: add binding for adi,adt7470 Luiz Angelo Daros de Luca
2026-07-16 21:32 ` sashiko-bot
2026-07-17 2:33 ` Luiz Angelo Daros de Luca
2026-07-16 21:21 ` [PATCH 2/4] hwmon: (adt7470) Add ADT7470_PWM_MAX macro Luiz Angelo Daros de Luca
2026-07-16 21:32 ` sashiko-bot [this message]
2026-07-16 21:21 ` [PATCH 3/4] hwmon: (adt7470) Add thermal cooling device support Luiz Angelo Daros de Luca
2026-07-16 21:37 ` sashiko-bot
2026-07-16 21:21 ` [PATCH 4/4] hwmon: (adt7470) Add thermal zone sensor support Luiz Angelo Daros de Luca
2026-07-16 21:36 ` sashiko-bot
2026-07-16 23:12 ` Guenter Roeck
2026-07-17 2:48 ` Luiz Angelo Daros de Luca
2026-07-16 23:14 ` [PATCH 0/4] hwmon: (adt7470) Add thermal framework support Guenter Roeck
2026-07-16 23:19 ` Luiz Angelo Daros de Luca
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=20260716213252.EACA71F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=luizluca@gmail.com \
--cc=robh@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.