Skip to contentSkip to conversation

staging: sm750fb: add const to g_fbmode array

PATCH In review Diego Fernando Mancera Gómez 2 participants 4 messages May 21

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

PATCH 1/1 staging: sm750fb: add const to g_fbmode array

---
 drivers/staging/sm750fb/sm750.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/sm750fb/sm750.c +1 -1
index 89c811e0806c..8f533f3b1b42 100644
@@ -21,7 +21,7 @@
 static int g_hwcursor = 1;
 static int g_noaccel __ro_after_init;
 static int g_nomtrr __ro_after_init;
-static const char *g_fbmode[] = {NULL, NULL};
+static const char * const g_fbmode[] = {NULL, NULL};
 static const char *g_def_fbmode = "1024x768-32@60";
 static char *g_settings;
 static int g_dualview __ro_after_init;
Signature · 1 line
2.43.0
#1 lore raw
Quoted 10 lines · Diego Fernando Mancera Gómez
---
  drivers/staging/sm750fb/sm750.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/sm750fb/sm750.c +0 -0
index 89c811e0806c..8f533f3b1b42 100644

drivers/staging/sm750fb/sm750.c line 27

Quoted 8 lines
drivers/staging/sm750fb/sm750.c +1 -1
@@ -21,7 +21,7 @@
  static int g_hwcursor = 1;
  static int g_noaccel __ro_after_init;
  static int g_nomtrr __ro_after_init;
-static const char *g_fbmode[] = {NULL, NULL};
+static const char * const g_fbmode[] = {NULL, NULL};
  static const char *g_def_fbmode = "1024x768-32@60";
  static char *g_settings;
  static int g_dualview __ro_after_init;

Did you compile these changes?

Regards,
Ahmet Sezgin Duran

#2 lore raw
In reply to Diego Fernando Mancera Gómez

Replying an off-list email:

Quoted 5 lines

To: Ahmet Sezgin Duran Subject: Re: [PATCH] staging: sm750fb: add const to g_fbmode array

Hi Ahmet,

Quoted 33 lines

Yes, I have verified the changes. I compiled the module using make M=drivers/staging/sm750fb/ and it compiled successfully without any errors or warnings.

Regards, Diego Fernando Mancera Gómez

Quoted 25 lines · Ahmet Sezgin Duran
Quoted 10 lines · Diego Fernando Mancera Gómez
---
  drivers/staging/sm750fb/sm750.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/sm750fb/sm750.c +0 -0
index 89c811e0806c..8f533f3b1b42 100644

drivers/staging/sm750fb/sm750.c line 27

Quoted 8 lines
drivers/staging/sm750fb/sm750.c +1 -1
@@ -21,7 +21,7 @@
  static int g_hwcursor = 1;
  static int g_noaccel __ro_after_init;
  static int g_nomtrr __ro_after_init;
-static const char *g_fbmode[] = {NULL, NULL};
+static const char * const g_fbmode[] = {NULL, NULL};
  static const char *g_def_fbmode = "1024x768-32@60";
  static char *g_settings;
  static int g_dualview __ro_after_init;

Did you compile these changes?

Regards,
Ahmet Sezgin Duran

Please reply emails using Reply All and avoid top posting.

Quoted 3 lines

Yes, I have verified the changes. I compiled the module using make M=drivers/staging/sm750fb/ and it compiled successfully without any errors or warnings.

Can you make sure that you had enabled the related module?

Regards,
Ahmet Sezgin Duran

#3 lore raw
Quoted 2 lines · Ahmet Sezgin Duran

Can you make sure that you had enabled the related module?

Hi Ahmet,

You caught me. I sincerely apologize.

I forced the compilation by running make drivers/staging/sm750fb/sm750.o and immediately saw the errors:
error: assignment of read-only location ‘g_fbmode[index]’

I realize now that adding the second const breaks the driver because g_fbmode is dynamically assigned at runtime inside sm750fb_setup and lynxfb_set_fbinfo. The checkpatch.pl warning was a false positive in this specific context, and I failed to verify the build properly before sending the patch.

Please drop this patch. Thank you very much for the lesson in C semantics, build discipline, and mailing list etiquette. It won't happen again.

Regards,
Diego Fernando Mancera Gómez

Quoted 52 lines · Ahmet Sezgin Duran

Replying an off-list email:

Quoted 5 lines

To: Ahmet Sezgin Duran Subject: Re: [PATCH] staging: sm750fb: add const to g_fbmode array

Hi Ahmet,

Quoted 33 lines

Yes, I have verified the changes. I compiled the module using make M=drivers/staging/sm750fb/ and it compiled successfully without any errors or warnings.

Regards, Diego Fernando Mancera Gómez

Quoted 25 lines · Ahmet Sezgin Duran
Quoted 10 lines · Diego Fernando Mancera Gómez
---
  drivers/staging/sm750fb/sm750.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/sm750fb/sm750.c +0 -0
index 89c811e0806c..8f533f3b1b42 100644

drivers/staging/sm750fb/sm750.c line 27

Quoted 8 lines
drivers/staging/sm750fb/sm750.c +1 -1
@@ -21,7 +21,7 @@
  static int g_hwcursor = 1;
  static int g_noaccel __ro_after_init;
  static int g_nomtrr __ro_after_init;
-static const char *g_fbmode[] = {NULL, NULL};
+static const char * const g_fbmode[] = {NULL, NULL};
  static const char *g_def_fbmode = "1024x768-32@60";
  static char *g_settings;
  static int g_dualview __ro_after_init;

Did you compile these changes?

Regards,
Ahmet Sezgin Duran

Please reply emails using Reply All and avoid top posting.

Quoted 3 lines

Yes, I have verified the changes. I compiled the module using make M=drivers/staging/sm750fb/ and it compiled successfully without any errors or warnings.

Can you make sure that you had enabled the related module?

Regards,
Ahmet Sezgin Duran