checkpatch doesn't recognize register or volatile declarations (was Re: [Outreachy kernel] [PATCH] staging: ralink-gdma: Move blank line to fix warning)

From: Joe Perches
Date: Thu Apr 02 2020 - 23:15:29 EST


(adding lkml)

On Thu, 2020-04-02 at 18:21 -0700, John B. Wyatt IV wrote:
> On Thu, 2020-04-02 at 11:31 +0200, Julia Lawall wrote:
> > On Thu, 2 Apr 2020, John B. Wyatt IV wrote:
> >
> > > Move a blank line within a struct to fix/silence a style warning.
> > >
> > > Reported by checkpatch.
> > >
> > > Signed-off-by: John B. Wyatt IV <jbwyatt4@xxxxxxxxx>
> > > ---
> > > Note:
> > > ralink-gdma does not build; even with make allyesconfig.
> > > I did not find a menu option with make menuconfig.
> > >
> > > drivers/staging/ralink-gdma/ralink-gdma.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/staging/ralink-gdma/ralink-gdma.c
> > > b/drivers/staging/ralink-gdma/ralink-gdma.c
> > > index eabf1093328e..9c398048daac 100644
> > > --- a/drivers/staging/ralink-gdma/ralink-gdma.c
> > > +++ b/drivers/staging/ralink-gdma/ralink-gdma.c
> > > @@ -122,9 +122,9 @@ struct gdma_dma_dev {
> > > struct gdma_data *data;
> > > void __iomem *base;
> > > struct tasklet_struct task;
> > > +
> >
> > Adding a blank line here is not correct. checkpatch is confused.
>
> It is not, but I was unsure of how this should be addressed. Thank you
> for letting me know.
>
> The second version of the patch removes the blank line.
>
> > Perhaps
> > it lacks a pattern considering wolatile to indicate a type.
>
> I have CC'ed Joe Perches on this.
>

Well, perhaps this, but it might cause other undesired change.
I haven't tested it much.

Maybe for older c, this list should even include "auto" too.

btw: the linux kernel sources do not have a single instance of
auto as far as I can tell with a trivial search.

---
scripts/checkpatch.pl | 2 ++
1 file changed, 2 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d64c67..e906a8 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -372,6 +372,8 @@ our $InitAttribute = qr{$InitAttributeData|$InitAttributeConst|$InitAttributeIni
# We need \b after 'init' otherwise 'initconst' will cause a false positive in a check
our $Attribute = qr{
const|
+ volatile|
+ register|
__percpu|
__nocast|
__safe|