The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Lee Jones <lee.jones@linaro.org>
Cc: Andy Whitcroft <apw@canonical.com>, linux-kernel@vger.kernel.org
Subject: Re: Checkpatch query
Date: Mon, 21 Jul 2014 06:06:25 -0700	[thread overview]
Message-ID: <1405947985.21586.5.camel@joe-AO725> (raw)
In-Reply-To: <20140721113948.GX30888@lee--X1>

On Mon, 2014-07-21 at 12:39 +0100, Lee Jones wrote:
> Hi Andy, Joe,

Hi Lee.

> When running checkpatch on drivers/mfd/tps80031.c I recieve the
> following warning:
> 
> > WARNING: Possible switch case/default not preceeded by break or
> >          fallthrough comment
> > #337: FILE: drivers/mfd/tps80031.c:337:
> > +       case TPS80031_BACKUP_REG:
> > 
> > total: 0 errors, 1 warnings, 573 lines checked
> 
> ... but we use switch statement fall through all the time when
> identifying different types of registers used with Regmap.  Placing a
> fall-through comment between them all sounds very messy to me.

Yes, it can be messy, but it's found some
actual bugs/defects.

> Also, the warning only fires on 'case's which do not use '...'
> notation, which seems a little odd.

That's a checkpatch defect.  Thanks for the report.

> Anyway, I'm not sure placing a 'fall through' comment makes the code
> any cleaner or reduces possible failure rate in any way.  Is there any
> chance that this check can be removed?

You could use the --ignore= cmd-line option or add it to
a .checkpatch.conf file.

$ ./scripts/checkpatch.pl -f drivers/mfd/tps80031.c  --ignore=missing_break
WARNING: Possible unnecessary 'out of memory' message
#435: FILE: drivers/mfd/tps80031.c:435:
+	if (!tps80031) {
+		dev_err(&client->dev, "Malloc failed for tps80031\n");

total: 0 errors, 1 warnings, 573 lines checked

NOTE: Ignored message types: MISSING_BREAK

drivers/mfd/tps80031.c has style problems, please review.

If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.



  reply	other threads:[~2014-07-21 13:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-21 11:39 Checkpatch query Lee Jones
2014-07-21 13:06 ` Joe Perches [this message]
2014-07-21 13:13 ` [PATCH] checkpatch: Allow case labels with ranges Joe Perches
2014-07-21 13:21   ` Lee Jones
2014-07-21 14:28     ` Joe Perches
2014-07-21 14:54       ` Lee Jones
     [not found]       ` <20140721143013.11ec351d47a9f822313247d2@linux-foundation.org>
2014-07-21 23:09         ` [PATCH] checkpatch: Fix false positive MISSING_BREAK warnings with --file Joe Perches
2014-07-22  7:05           ` Lee Jones

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=1405947985.21586.5.camel@joe-AO725 \
    --to=joe@perches.com \
    --cc=apw@canonical.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox