From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: sudipm.mukherjee@gmail.com, teddy.wang@siliconmotion.com,
gregkh@linuxfoundation.org, outreachy-kernel@googlegroups.com,
mike.rapoport@gmail.com, kushalkothari2850@gmail.com,
Kushal Kothari <kushalkothari285@gmail.com>,
Kushal Kothari <kushalkothari285@gmail.com>,
Joe Perches <joe@perches.com>
Subject: Re: [Outreachy kernel] [PATCH] staging: sm750fb: make pointers in array const
Date: Mon, 18 Oct 2021 19:18:35 +0200 [thread overview]
Message-ID: <9033544.t7rfKEcqWj@localhost.localdomain> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2110181900410.3174@hadrien>
On Monday, October 18, 2021 7:01:42 PM CEST Julia Lawall wrote:
>
> On Mon, 18 Oct 2021, Fabio M. De Francesco wrote:
>
> > On Monday, October 18, 2021 6:44:31 PM CEST Kushal Kothari wrote:
> > > Change the parameters of functions from const char *g_fbmode[] to
> > > const char * const g_fbmode[]. This additional const is needed to
> > > allow us to fix checkpatch warning, as well as being good
> > > programming practice.
> > >
> > > For the checkpatch warnings, if we have a set of command line
> > > args that we want to check defined as:
> > > static const char * g_fbmode[] = {NULL, NULL};
> > >
> > > checkpatch will complain:
> > > WARNING: static const char * array should probably be static
const
> > char * const
> > >
> > > Signed-off-by: Kushal Kothari <kushalkothari285@gmail.com>
> > > ---
> > >
> > > [...]
> > >
> > > -static const char *g_fbmode[] = {NULL, NULL};
> > > +static const char * const g_fbmode[] = {NULL, NULL};
> >
> > You have introduced a logical change (g_fbmode[] entries cannot be
assigned
> > any more) and a build error (because there is code somewhere that assigns
> > values to those slots).
>
> I wonder if this warning makes much sense when the array elements are
> NULL. I don't know if checkpatch could easily detect that.
>
> julia
Unfortunately I cannot change checkpatch.pl because I am not able to program
with Perl.
However, it should be an easy fix in whatever programming language:
checkpatch should warn if and only if the array elements are assigned with
non 'NULL' values, because it's pretty clear that somewhere else there must
be some lines that assign values to them.
Fabio
>
> >
> > Please, build the code after you've changed it.
> >
> > Thanks,
> >
> > Fabio
> >
> > > static const char *g_def_fbmode = "1024x768-32@60";
> > > static char *g_settings;
> > > static int g_dualview;
> > > --
> > > 2.25.1
> > >
next prev parent reply other threads:[~2021-10-18 17:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-18 16:44 [PATCH] staging: sm750fb: make pointers in array const Kushal Kothari
2021-10-18 16:54 ` [Outreachy kernel] " Fabio M. De Francesco
2021-10-18 17:01 ` Julia Lawall
2021-10-18 17:18 ` Fabio M. De Francesco [this message]
2021-10-18 18:22 ` Joe Perches
2021-10-18 18:34 ` Fabio M. De Francesco
2021-10-18 18:43 ` Julia Lawall
2021-10-18 18:56 ` kushal kothari
2021-10-18 19:53 ` Alison Schofield
2021-10-18 18:56 ` Fabio M. De Francesco
2021-10-18 18:52 ` Joe Perches
2021-10-18 19:01 ` Fabio M. De Francesco
2021-10-18 18:18 ` Fabio M. De Francesco
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9033544.t7rfKEcqWj@localhost.localdomain \
--to=fmdefrancesco@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=julia.lawall@inria.fr \
--cc=kushalkothari2850@gmail.com \
--cc=kushalkothari285@gmail.com \
--cc=mike.rapoport@gmail.com \
--cc=outreachy-kernel@googlegroups.com \
--cc=sudipm.mukherjee@gmail.com \
--cc=teddy.wang@siliconmotion.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.