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 <flaviu.nistor@gmail.com>
Link: https://patch.msgid.link/20260826184750.4798-3-flaviu.nistor@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Flaviu Nistor 2026-08-26 21:47:49 +03:00 committed by Guenter Roeck
parent 61379d4d88
commit e3011805cf

View File

@ -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);