Skip to content

Commit d22bd45

Browse files
tititiou36groeck
authored andcommitted
hwmon: (pmbus/mpq7932) Constify struct regulator_desc
'struct regulator_desc' is not modified in this driver. Constifying this structure moves some data to a read-only section, so increase overall security, especially when the structure holds some function pointers. This also makes mpq7932_regulators_desc consistent with mpq7932_regulators_desc_one which is already a "static const struct regulator_desc". On a x86_64, with allmodconfig: Before: ====== text data bss dec hex filename 3516 2264 0 5780 1694 drivers/hwmon/pmbus/mpq7932.o After: ===== text data bss dec hex filename 5396 384 0 5780 1694 drivers/hwmon/pmbus/mpq7932.o Signed-off-by: Christophe JAILLET <[email protected]> Message-ID: <c0585a07547ec58d99a5bff5e02b398114bbe312.1725784343.git.christophe.jaillet@wanadoo.fr> Signed-off-by: Guenter Roeck <[email protected]>
1 parent 3cd1ef2 commit d22bd45

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/hwmon/pmbus/mpq7932.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct mpq7932_data {
3535
};
3636

3737
#if IS_ENABLED(CONFIG_SENSORS_MPQ7932_REGULATOR)
38-
static struct regulator_desc mpq7932_regulators_desc[] = {
38+
static const struct regulator_desc mpq7932_regulators_desc[] = {
3939
PMBUS_REGULATOR_STEP("buck", 0, MPQ7932_N_VOLTAGES,
4040
MPQ7932_UV_STEP, MPQ7932_BUCK_UV_MIN),
4141
PMBUS_REGULATOR_STEP("buck", 1, MPQ7932_N_VOLTAGES,

0 commit comments

Comments
 (0)