]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
hwmon: (w83627ehf) make the read-only arrays 'bit' static const
authorColin Ian King <colin.i.king@gmail.com>
Mon, 14 Jul 2025 15:55:05 +0000 (16:55 +0100)
committerGuenter Roeck <linux@roeck-us.net>
Sun, 20 Jul 2025 23:38:34 +0000 (16:38 -0700)
Don't populate the read-only arrays 'bit' on the stack at run time,
instead make them static const.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20250714155505.1234012-1-colin.i.king@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/w83627ehf.c

index 7d7d70afde65523d4e8fdf2cfd4b29f1f9616d88..a23edd35c19ffc0b21f3515caf57a6a8c1decabe 100644 (file)
@@ -1448,7 +1448,8 @@ w83627ehf_do_read_temp(struct w83627ehf_data *data, u32 attr,
                return 0;
        case hwmon_temp_alarm:
                if (channel < 3) {
-                       int bit[] = { 4, 5, 13 };
+                       static const int bit[] = { 4, 5, 13 };
+
                        *val = (data->alarms >> bit[channel]) & 1;
                        return 0;
                }
@@ -1479,7 +1480,8 @@ w83627ehf_do_read_in(struct w83627ehf_data *data, u32 attr,
                return 0;
        case hwmon_in_alarm:
                if (channel < 10) {
-                       int bit[] = { 0, 1, 2, 3, 8, 21, 20, 16, 17, 19 };
+                       static const int bit[] = { 0, 1, 2, 3, 8, 21, 20, 16, 17, 19 };
+
                        *val = (data->alarms >> bit[channel]) & 1;
                        return 0;
                }
@@ -1507,7 +1509,8 @@ w83627ehf_do_read_fan(struct w83627ehf_data *data, u32 attr,
                return 0;
        case hwmon_fan_alarm:
                if (channel < 5) {
-                       int bit[] = { 6, 7, 11, 10, 23 };
+                       static const int bit[] = { 6, 7, 11, 10, 23 };
+
                        *val = (data->alarms >> bit[channel]) & 1;
                        return 0;
                }