From: sashiko-bot@kernel.org
To: "Flaviu Nistor" <flaviu.nistor@gmail.com>
Cc: robh@kernel.org, conor+dt@kernel.org,
linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 2/2] hwmon: (lm90) Reject channel 2 on chips with only one remote sensor
Date: Mon, 24 Aug 2026 18:50:15 +0000 [thread overview]
Message-ID: <20260824185016.541E51F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260824183900.8983-3-flaviu.nistor@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Setting the temperature offset for channel 2 during probe clobbers the device's hardware configuration register because `data->config` is used before it is initialized.
--
--- Patch [2]: [PATCH 2/2] hwmon: (lm90) Reject channel 2 on chips with only one remote sensor ---
commit dbe7fc3f39616fac014beb08a22b533d36d4c54b
Author: Flaviu Nistor <flaviu.nistor@gmail.com>
Subject: hwmon: (lm90) Reject channel 2 on chips with only one remote sensor
This patch validates firmware channel definitions against chip capabilities
and returns -EINVAL when channel 2 is configured on devices with 1 remote
channel.
> diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
> index 1c603272538aa..3faeb2c6ab01b 100644
> --- a/drivers/hwmon/lm90.c
> +++ b/drivers/hwmon/lm90.c
> @@ -2712,6 +2712,11 @@ static int lm90_probe_channel(struct i2c_client *client,
> return -EINVAL;
> }
>
> + if (id == 2 && !(data->flags & LM90_HAVE_TEMP3)) {
> + dev_err(dev, "channel %d is not supported for this chip in %pfw\n", id, child);
> + return -EINVAL;
> + }
> +
[Severity: High]
This is a pre-existing issue, but I noticed a potential problem when channel 2
is valid and has a temperature offset configured.
In lm90_probe(), lm90_parse_channel_info() is called before
lm90_init_client(). If the device tree specifies the property
temperature-offset-millicelsius for channel 2, it invokes
lm90_set_temp_offset() further down in lm90_probe_channel().
For channel 2, lm90_set_temp_offset() calls lm90_select_remote_channel():
drivers/hwmon/lm90.c:lm90_set_temp_offset() {
...
/* For ADT7481 we can use the same registers for remote channel 1 and 2 */
if (channel > 1)
lm90_select_remote_channel(data, true);
...
}
Because lm90_init_client() hasn't executed yet, data->config is still 0 from
its initial allocation. This causes the driver to write 0 directly to the
hardware configuration register, which might clobber the original
BIOS/bootloader configuration before it is ever read and saved.
Could this silently overwrite the chip's thermal alert masks or run states
during device probe on systems providing the offset property?
> err = fwnode_property_read_string(child, "label", &data->channel_label[id]);
> if (err == -ENODATA || err == -EILSEQ) {
> dev_err(dev, "invalid label property in %pfw\n", child);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260824183900.8983-1-flaviu.nistor@gmail.com?part=2
prev parent reply other threads:[~2026-08-24 18:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 18:38 [PATCH 0/2] hwmon: lm90: Fix DT channel constraints and reject unsupported channel 2 Flaviu Nistor
2026-08-24 18:38 ` [PATCH 1/2] dt-bindings: hwmon: national,lm90: Fix channel constraints for temperature offset Flaviu Nistor
2026-08-24 18:49 ` sashiko-bot
2026-08-25 16:58 ` Conor Dooley
2026-08-24 18:39 ` [PATCH 2/2] hwmon: (lm90) Reject channel 2 on chips with only one remote sensor Flaviu Nistor
2026-08-24 18:50 ` sashiko-bot [this message]
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=20260824185016.541E51F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=flaviu.nistor@gmail.com \
--cc=linux-hwmon@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox