Skip to contentSkip to conversation

Input: cypress-sf - Constify struct i2c_device_id

PATCH Applied Christophe JAILLET 2 participants 2 messages Nov 15, 2024 – Nov 19, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: cypress-sf - Constify struct i2c_device_id

'struct i2c_device_id' is not modified in this driver.

Constifying this structure moves some data to a read-only section, so increase overall security.

On a x86_64, with allmodconfig:
Before:
======
text data bss dec hex filename
6438 618 0 7056 1b90 drivers/input/keyboard/cypress-sf.o

After:
=====
text data bss dec hex filename
6502 554 0 7056 1b90 drivers/input/keyboard/cypress-sf.o

---
Compile tested-only.

---
 drivers/input/keyboard/cypress-sf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/keyboard/cypress-sf.c +1 -1
index eb1d0720784d..335b72efc5aa 100644
@@ -208,7 +208,7 @@ static int cypress_sf_resume(struct device *dev)
 static DEFINE_SIMPLE_DEV_PM_OPS(cypress_sf_pm_ops,
 				cypress_sf_suspend, cypress_sf_resume);
 
-static struct i2c_device_id cypress_sf_id_table[] = {
+static const struct i2c_device_id cypress_sf_id_table[] = {
 	{ CYPRESS_SF_DEV_NAME },
 	{ }
 };
Signature · 1 line
2.47.0
maintainer Applied
#1 lore raw
Quoted 11 lines · Christophe JAILLET

'struct i2c_device_id' is not modified in this driver.

Constifying this structure moves some data to a read-only section, so increase overall security.

On a x86_64, with allmodconfig:
Before:
======
text data bss dec hex filename
6438 618 0 7056 1b90 drivers/input/keyboard/cypress-sf.o

Quoted 6 lines

After:
=====
text data bss dec hex filename
6502 554 0 7056 1b90 drivers/input/keyboard/cypress-sf.o

Applied, thank you.

Signature · 1 line
Dmitry