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

firmware: arm_scmi: Constify struct scmi_voltage_proto_ops

Constify struct scmi_voltage_proto_ops since the driver never modifies
it. Placing it in read-only memory (.rodata) improves hardening,
particularly because it contains function pointers.

x86_64 (allmodconfig) size impact:

Before:
text data bss dec hex filename
13142 1808 0 14950 3a66 drivers/firmware/arm_scmi/voltage.o

After:
text data bss dec hex filename
13238 1712 0 14950 3a66 drivers/firmware/arm_scmi/voltage.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Message-Id: <2091660c072dd2d5599897243a5d69e89d46ed4d.1753816459.git.christophe.jaillet@wanadoo.fr>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

authored by

Christophe JAILLET and committed by
Sudeep Holla
abd658d3 a4d5f63d

+1 -1
+1 -1
drivers/firmware/arm_scmi/voltage.c
··· 393 393 return vinfo->num_domains; 394 394 } 395 395 396 - static struct scmi_voltage_proto_ops voltage_proto_ops = { 396 + static const struct scmi_voltage_proto_ops voltage_proto_ops = { 397 397 .num_domains_get = scmi_voltage_domains_num_get, 398 398 .info_get = scmi_voltage_info_get, 399 399 .config_set = scmi_voltage_config_set,