Re: [PATCH] staging: sm750fb: constify static char pointer arrays
From: Denny Lin
Date: Tue Mar 31 2026 - 09:30:33 EST
Hi Greg,
Thanks for the reminder. I will make sure to test-build my changes
before submitting patches next time.
Best regards,
Hungyu Lin
On Tue, Mar 31, 2026 at 1:45 AM Greg Kroah-Hartman
<gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> On Tue, Mar 31, 2026 at 05:07:38AM +0000, Hungyu Lin wrote:
> > The static const char * arrays 'g_fbmode' and 'fix_id' should be
> > defined as 'static const char * const' to make the pointer arrays
> > themselves constant. This allows the compiler to place them in the
> > read-only data section.
> >
> > Signed-off-by: Hungyu Lin <dennylin0707@xxxxxxxxx>
> > ---
> > drivers/staging/sm750fb/sm750.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
> > index 9a42a08c8..b0bdfaeca 100644
> > --- a/drivers/staging/sm750fb/sm750.c
> > +++ b/drivers/staging/sm750fb/sm750.c
> > @@ -33,7 +33,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 = "1024x768-32@60";
> > static char *g_settings;
> > static int g_dualview;
> > @@ -728,7 +728,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
> > lynx750_ext, NULL, vesa_modes,
> > };
> > int cdb[] = {ARRAY_SIZE(lynx750_ext), 0, VESA_MODEDB_SIZE};
> > - static const char *fix_id[2] = {
> > + static const char * const fix_id[2] = {
> > "sm750_fb1", "sm750_fb2",
> > };
> >
> > --
> > 2.34.1
> >
> >
>
> Please always test-build your changes so you do not get grumpy kernel
> maintainers asking you why you did not test-build your changes :(
>
> thanks,
>
> greg k-h