]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
cxgb4: Constify struct thermal_zone_device_ops
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 25 May 2025 09:21:24 +0000 (11:21 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 28 May 2025 00:31:42 +0000 (17:31 -0700)
'struct thermal_zone_device_ops' are not modified in this driver.

Constifying these structures moves some data to a read-only section, so
increases overall security, especially when the structure holds some
function pointers.

On a x86_64, with allmodconfig:
Before:
======
   text    data     bss     dec     hex filename
   2912    1064       0    3976     f88 drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.o

After:
=====
   text    data     bss     dec     hex filename
   3040     936       0    3976     f88 drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://patch.msgid.link/e6416e0d15ea27a55fe1fb4e349928ac7bae1b95.1748164843.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c

index b08356060fb465bfb18158e85111a7d7f78547aa..7bab8da8f6e616ed6e3c6404c2a2ab32f47ea5c4 100644 (file)
@@ -29,7 +29,7 @@ static int cxgb4_thermal_get_temp(struct thermal_zone_device *tzdev,
        return 0;
 }
 
-static struct thermal_zone_device_ops cxgb4_thermal_ops = {
+static const struct thermal_zone_device_ops cxgb4_thermal_ops = {
        .get_temp = cxgb4_thermal_get_temp,
 };