[PATCH 2/2] hwmon: (lm90) Reject channel 2 on chips with only one remote sensor
From: Flaviu Nistor
Date: Mon Aug 24 2026 - 14:39:52 EST
Validate firmware channel definitions against chip capabilities and return
-EINVAL when channel 2 is configured on devices with 1 remote channel.
Signed-off-by: Flaviu Nistor <flaviu.nistor@xxxxxxxxx>
---
drivers/hwmon/lm90.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index 1c603272538a..3faeb2c6ab01 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;
+ }
+
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);
--
2.34.1