diff options
| author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2025-03-29 15:37:07 +0100 |
|---|---|---|
| committer | Andi Shyti <andi@smida.it> | 2025-05-19 22:23:54 +0200 |
| commit | 504cb3ce5215da58c07a923379fa9b1ce6797161 (patch) | |
| tree | 5207dbc3cb17860b514187c45ca3e7b465e6bfb6 /drivers/i2c | |
| parent | f4a5f881523196efee8c97ab292a30f295258fef (diff) | |
| download | net-504cb3ce5215da58c07a923379fa9b1ce6797161.tar.gz | |
i2c: rzv2m: Constify struct i2c_algorithm
'struct i2c_algorithm' 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.
On a x86_64, with allmodconfig, as an example:
Before:
======
text data bss dec hex filename
11027 646 16 11689 2da9 drivers/i2c/busses/i2c-rzv2m.o
After:
=====
text data bss dec hex filename
11107 566 16 11689 2da9 drivers/i2c/busses/i2c-rzv2m.o
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
Link: https://lore.kernel.org/r/537d93441ced53bffa6553b8ec93d007e64cb9a5.1743258995.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Diffstat (limited to 'drivers/i2c')
| -rw-r--r-- | drivers/i2c/busses/i2c-rzv2m.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-rzv2m.c b/drivers/i2c/busses/i2c-rzv2m.c index 53762cc56d284a..b0e9c0b624292c 100644 --- a/drivers/i2c/busses/i2c-rzv2m.c +++ b/drivers/i2c/busses/i2c-rzv2m.c @@ -402,7 +402,7 @@ static const struct i2c_adapter_quirks rzv2m_i2c_quirks = { .flags = I2C_AQ_NO_ZERO_LEN, }; -static struct i2c_algorithm rzv2m_i2c_algo = { +static const struct i2c_algorithm rzv2m_i2c_algo = { .xfer = rzv2m_i2c_xfer, .functionality = rzv2m_i2c_func, }; |
