Add test if thermistor sensor type attribute should be visible, i.e. test if the attribute is defined. Signed-off-by: Frank Crawford <frank@xxxxxxxxxxxxxxxxxx> --- v2: * Split single patch into multi-patch set following review. --- drivers/hwmon/it87.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 7a1224ddc8b1..fb62f2a7017a 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -2330,6 +2330,14 @@ static umode_t it87_temp_is_visible(struct kobject *kobj, if (!(data->has_temp & BIT(i))) return 0; + if (a == 3) { + int type = get_temp_type(data, i); + + if (type == 0) + return 0; + return attr->mode; + } + if (a == 5 && !has_temp_offset(data)) return 0; -- 2.41.0