Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <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>

authored by

Colin Ian King and committed by
Guenter Roeck
bb4eb573 0429415a

+6 -3
+6 -3
drivers/hwmon/w83627ehf.c
··· 1448 1448 return 0; 1449 1449 case hwmon_temp_alarm: 1450 1450 if (channel < 3) { 1451 - int bit[] = { 4, 5, 13 }; 1451 + static const int bit[] = { 4, 5, 13 }; 1452 + 1452 1453 *val = (data->alarms >> bit[channel]) & 1; 1453 1454 return 0; 1454 1455 } ··· 1480 1479 return 0; 1481 1480 case hwmon_in_alarm: 1482 1481 if (channel < 10) { 1483 - int bit[] = { 0, 1, 2, 3, 8, 21, 20, 16, 17, 19 }; 1482 + static const int bit[] = { 0, 1, 2, 3, 8, 21, 20, 16, 17, 19 }; 1483 + 1484 1484 *val = (data->alarms >> bit[channel]) & 1; 1485 1485 return 0; 1486 1486 } ··· 1509 1507 return 0; 1510 1508 case hwmon_fan_alarm: 1511 1509 if (channel < 5) { 1512 - int bit[] = { 6, 7, 11, 10, 23 }; 1510 + static const int bit[] = { 6, 7, 11, 10, 23 }; 1511 + 1513 1512 *val = (data->alarms >> bit[channel]) & 1; 1514 1513 return 0; 1515 1514 }