Skip to content

Commit bb4eb57

Browse files
ColinIanKinggroeck
authored andcommitted
hwmon: (w83627ehf) make the read-only arrays 'bit' static const
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 0429415 commit bb4eb57

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/hwmon/w83627ehf.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,8 @@ w83627ehf_do_read_temp(struct w83627ehf_data *data, u32 attr,
14481448
return 0;
14491449
case hwmon_temp_alarm:
14501450
if (channel < 3) {
1451-
int bit[] = { 4, 5, 13 };
1451+
static const int bit[] = { 4, 5, 13 };
1452+
14521453
*val = (data->alarms >> bit[channel]) & 1;
14531454
return 0;
14541455
}
@@ -1479,7 +1480,8 @@ w83627ehf_do_read_in(struct w83627ehf_data *data, u32 attr,
14791480
return 0;
14801481
case hwmon_in_alarm:
14811482
if (channel < 10) {
1482-
int bit[] = { 0, 1, 2, 3, 8, 21, 20, 16, 17, 19 };
1483+
static const int bit[] = { 0, 1, 2, 3, 8, 21, 20, 16, 17, 19 };
1484+
14831485
*val = (data->alarms >> bit[channel]) & 1;
14841486
return 0;
14851487
}
@@ -1507,7 +1509,8 @@ w83627ehf_do_read_fan(struct w83627ehf_data *data, u32 attr,
15071509
return 0;
15081510
case hwmon_fan_alarm:
15091511
if (channel < 5) {
1510-
int bit[] = { 6, 7, 11, 10, 23 };
1512+
static const int bit[] = { 6, 7, 11, 10, 23 };
1513+
15111514
*val = (data->alarms >> bit[channel]) & 1;
15121515
return 0;
15131516
}

0 commit comments

Comments
 (0)