Skip to contentSkip to conversation

Staging: sm750fb: make array char const

PATCH In review Muraru Mihaela 2 participants 4 messages Oct 2, 2016 – Oct 3, 2016

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

PATCH 1/1 Staging: sm750fb: make array char const

This patch fixes a chechpatch.pl warning in file sm750.c
WARNING: static const char * array should probably be static const char * const,by adding a missing const.

---
 drivers/staging/sm750fb/sm750.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/sm750fb/sm750.c +1 -1
index 7d90e25..90b6c64 100644
@@ -32,7 +32,7 @@
 static int g_hwcursor = 1;
 static int g_noaccel;
 static int g_nomtrr;
-static const char *g_fbmode[] = {NULL, NULL};
+static const char * const g_fbmode[] = {NULL, NULL};
 static const char *g_def_fbmode = "800x600-16@60";
 static char *g_settings;
 static int g_dualview;
Signature · 1 line
2.7.4
#1 lore raw
Quoted 14 lines · Muraru Mihaela

This patch fixes a chechpatch.pl warning in file sm750.c
WARNING: static const char * array should probably be static const char * const,by adding a missing const.

---
 drivers/staging/sm750fb/sm750.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/sm750fb/sm750.c +0 -0
index 7d90e25..90b6c64 100644

drivers/staging/sm750fb/sm750.c line 35

Quoted 5 lines
drivers/staging/sm750fb/sm750.c +1 -1
@@ -32,7 +32,7 @@
 static int g_hwcursor = 1;
 static int g_noaccel;
 static int g_nomtrr;
-static const char *g_fbmode[] = {NULL, NULL};
+static const char * const g_fbmode[] = {NULL, NULL};

Does this compile? It seems suspicious to have an array that contains only NULL NULL that is never updated. One would always know that both entries are NULL, so there would be no need to look in the array.

In practice, there seem to be some updates to the array elements in the code.

julia

Quoted 7 lines
drivers/staging/sm750fb/sm750.c +0 -1
 static const char *g_def_fbmode = "800x600-16@60";
 static char *g_settings;
 static int g_dualview;
--

2.7.4

#2 lore raw
Quoted 28 lines · Julia Lawall
Quoted 14 lines · Muraru Mihaela

This patch fixes a chechpatch.pl warning in file sm750.c
WARNING: static const char * array should probably be static const char * const,by adding a missing const.

---
 drivers/staging/sm750fb/sm750.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/sm750fb/sm750.c +0 -0
index 7d90e25..90b6c64 100644

drivers/staging/sm750fb/sm750.c line 35

Quoted 5 lines
drivers/staging/sm750fb/sm750.c +1 -1
@@ -32,7 +32,7 @@
 static int g_hwcursor = 1;
 static int g_noaccel;
 static int g_nomtrr;
-static const char *g_fbmode[] = {NULL, NULL};
+static const char * const g_fbmode[] = {NULL, NULL};

Does this compile? It seems suspicious to have an array that contains only NULL NULL that is never updated. One would always know that both entries are NULL, so there would be no need to look in the array.

Quoted 4 lines

In practice, there seem to be some updates to the array elements in the code.

julia

Sorry my mistake,I looked through the file and it is clearly not a good solving , I made a read only array, that I want to be update.

thanks,

mihaela

Quoted 7 lines
Quoted 7 lines
drivers/staging/sm750fb/sm750.c +0 -1
 static const char *g_def_fbmode = "800x600-16@60";
 static char *g_settings;
 static int g_dualview;
--

2.7.4

#3 lore raw
Quoted 29 lines · Muraru Mihaela
Quoted 28 lines · Julia Lawall
Quoted 14 lines · Muraru Mihaela

This patch fixes a chechpatch.pl warning in file sm750.c
WARNING: static const char * array should probably be static const char * const,by adding a missing const.

---
 drivers/staging/sm750fb/sm750.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/sm750fb/sm750.c +0 -0
index 7d90e25..90b6c64 100644

drivers/staging/sm750fb/sm750.c line 35

Quoted 5 lines
drivers/staging/sm750fb/sm750.c +1 -1
@@ -32,7 +32,7 @@
 static int g_hwcursor = 1;
 static int g_noaccel;
 static int g_nomtrr;
-static const char *g_fbmode[] = {NULL, NULL};
+static const char * const g_fbmode[] = {NULL, NULL};

Does this compile? It seems suspicious to have an array that contains only NULL NULL that is never updated. One would always know that both entries are NULL, so there would be no need to look in the array.

Quoted 8 lines
Quoted 4 lines

In practice, there seem to be some updates to the array elements in the code.

julia

Sorry my mistake,I looked through the file and it is clearly not a good solving , I made a read only array, that I want to be update.

You need to be sure that you have compiled the file you change before you send a patch. Whether a file is compiled depends on the configuration options. So you need to have an actual .o file for the changed file. And you should not ignore either warnings or errors.

julia