public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: platform: allegro-dvt: Constify struct regmap_config
@ 2024-05-05  7:28 Christophe JAILLET
  2024-05-08  9:00 ` Michael Tretter
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2024-05-05  7:28 UTC (permalink / raw)
  To: Michael Tretter, Pengutronix Kernel Team, Mauro Carvalho Chehab
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-media

'allegro_regmap_config' and 'allegro_sram_config' are not modified in this
diver and are only used as a const struct regmap_config.

Constifying these structures 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
  79587	   3706	    116	  83409	  145d1	drivers/media/platform/allegro-dvt/allegro-core.o

After:
   text	   data	    bss	    dec	    hex	filename
  80219	   3066	    116	  83401	  145c9	drivers/media/platform/allegro-dvt/allegro-core.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/media/platform/allegro-dvt/allegro-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/allegro-dvt/allegro-core.c b/drivers/media/platform/allegro-dvt/allegro-core.c
index da61f9beb6b4..1a19fef62e81 100644
--- a/drivers/media/platform/allegro-dvt/allegro-core.c
+++ b/drivers/media/platform/allegro-dvt/allegro-core.c
@@ -179,7 +179,7 @@ struct allegro_dev {
 	struct list_head channels;
 };
 
-static struct regmap_config allegro_regmap_config = {
+static const struct regmap_config allegro_regmap_config = {
 	.name = "regmap",
 	.reg_bits = 32,
 	.val_bits = 32,
@@ -188,7 +188,7 @@ static struct regmap_config allegro_regmap_config = {
 	.cache_type = REGCACHE_NONE,
 };
 
-static struct regmap_config allegro_sram_config = {
+static const struct regmap_config allegro_sram_config = {
 	.name = "sram",
 	.reg_bits = 32,
 	.val_bits = 32,
-- 
2.45.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-08  9:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-05  7:28 [PATCH] media: platform: allegro-dvt: Constify struct regmap_config Christophe JAILLET
2024-05-08  9:00 ` Michael Tretter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox