hwmon: (nct6775) Fix non-existent ALARM warning
PATCH 1/1 hwmon: (nct6775) Fix non-existent ALARM warning
Skip non-existent ALARM attribute to avoid a shift-out-of-bounds dmesg warning.
Reported-by Doug Smythies <[email protected]>
Closes https://lore.kernel.org/linux-hwmon/[email protected]/T/#mc69b690660eb50734a6b07506d74a119e0266f1b open here
Fixes b7f1f7b2523a ("hwmon: (nct6775) Additional TEMP registers for nct6799")
Signed-off-by Ahmad Khalifa <[email protected]>
--- drivers/hwmon/nct6775-core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/hwmon/nct6775-core.c +4 -0
@@ -1910,6 +1910,10 @@ static umode_t nct6775_in_is_visible(struct kobject *kobj,struct device *dev =kobj_to_dev (kobj);struct nct6775_data *data =dev_get_drvdata (dev);int in = index /5 ;/* voltage index */ +int nr = index %5 ;/* attribute index */ + +if (nr ==1 && data->ALARM_BITS[in] ==-1 ) +return 0 ;if (!(data->have_in &BIT (in)))return 0 ;
Signature · 1 line
2.39.2
Quoted 7 lines · Ahmad Khalifa
Skip non-existent ALARM attribute to avoid a shift-out-of-bounds dmesg warning.
Reported-by Doug Smythies <[email protected]>Closes https://lore.kernel.org/linux-hwmon/[email protected]/T/#mc69b690660eb50734a6b07506d74a119e0266f1b open hereFixes b7f1f7b2523a ("hwmon: (nct6775) Additional TEMP registers for nct6799")Signed-off-by Ahmad Khalifa <[email protected]>
Applied.
Thanks,
Guenter
Quoted 19 lines
--- drivers/hwmon/nct6775-core.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/hwmon/nct6775-core.c +4
-0@@ -1910,6 +1910,10 @@ static umode_t nct6775_in_is_visible(struct kobject *kobj,struct device *dev =kobj_to_dev (kobj);struct nct6775_data *data =dev_get_drvdata (dev);int in = index /5 ;/* voltage index */ +int nr = index %5 ;/* attribute index */ + +if (nr ==1 && data->ALARM_BITS[in] ==-1 ) +return 0 ;if (!(data->have_in &BIT (in)))return 0 ;