Skip to contentSkip to conversation

scsi: aic79xx: make read-only array tok_list static const

PATCH In review Colin Ian King 2 participants 2 messages Aug 9, 2022

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

PATCH 1/1 scsi: aic79xx: make read-only array tok_list static const

Don't populate the read-only array tok_list on the stack but instead make it static const. Also makes the object code a little smaller.

---
 drivers/scsi/aic7xxx/aic79xx_osm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/aic7xxx/aic79xx_osm.c +1 -1
index 928099163f0f..4ed40e6c5522 100644
@@ -1044,7 +1044,7 @@ ahd_parse_brace_option(char *opt_name, char *opt_arg, char *end, int depth,
 	int      instance;
 	int	 targ;
 	int	 done;
-	char	 tok_list[] = {'.', ',', '{', '}', '\0'};
+	static const char tok_list[] = {'.', ',', '{', '}', '\0'};
 
 	/* All options use a ':' name/arg separator */
 	if (*opt_arg != ':')
Signature · 1 line
2.35.3
#1 lore raw
Quoted 13 lines · Colin Ian King

Don't populate the read-only array tok_list on the stack but instead make it static const. Also makes the object code a little smaller.

---
  drivers/scsi/aic7xxx/aic79xx_osm.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/aic7xxx/aic79xx_osm.c +0 -0
index 928099163f0f..4ed40e6c5522 100644

drivers/scsi/aic7xxx/aic79xx_osm.c ahd_parse_brace_option(char *opt_name, char *opt_arg, char *end, int depth, · line 1047

Quoted 5 lines
drivers/scsi/aic7xxx/aic79xx_osm.c +1 -1
@@ -1044,7 +1044,7 @@ ahd_parse_brace_option(char *opt_name, char *opt_arg, char *end, int depth,
  	int      instance;
  	int	 targ;
  	int	 done;
-	char	 tok_list[] = {'.', ',', '{', '}', '\0'};
+	static const char tok_list[] = {'.', ',', '{', '}', '\0'};

Has it been considered to write the above code as follows?

static const char tok_list[] = ".,{}";

Thanks,

Bart.