From e3011805cf3368c00eed972426be0bc94767f20c Mon Sep 17 00:00:00 2001 From: Flaviu Nistor Date: Wed, 26 Aug 2026 21:47:49 +0300 Subject: [PATCH] hwmon: (lm90) Reject channel 2 on chips with only one remote sensor 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 Link: https://patch.msgid.link/20260826184750.4798-3-flaviu.nistor@gmail.com Signed-off-by: Guenter Roeck --- 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);