mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yuval Mintz <yuvalmin@broadcom.com>
To: Joe Perches <joe@perches.com>, Ariel Elior <ariele@broadcom.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: RE: bnx2x_sriov.c: Missing switch/case breaks?
Date: Sat, 14 Dec 2013 06:16:46 +0000	[thread overview]
Message-ID: <979A8436335E3744ADCD3A9F2A2B68A52AF1A735@SJEXCHMB10.corp.ad.broadcom.com> (raw)
In-Reply-To: <1386975703.2479.48.camel@joe-AO722>

> Hi Ariel.
> 
> I wrote a little checkpatch script to look for missing
> switch/case breaks.
> 
> http://www.kernelhub.org/?msg=379933&p=2
> 
> There are _many_ instances of case blocks in sriov.c
> that could be missing breaks as they use fall-throughs.
> 
> It would be good if these are actually intended to be
> fall-throughs to add a /* fall-through */ comment between
> each case block.
> 
> For instance:
> 
> static void bnx2x_vfop_qctor(struct bnx2x *bp, struct bnx2x_virtf *vf)
> {
> [...]
> 	switch (state) {
> 	case BNX2X_VFOP_QCTOR_INIT:
> 
> 		/* has this queue already been opened? */
> 		if (bnx2x_get_q_logical_state(bp, q_params->q_obj) ==
> 		    BNX2X_Q_LOGICAL_STATE_ACTIVE) {
> 			DP(BNX2X_MSG_IOV,
> 			   "Entered qctor but queue was already up. Aborting
> gracefully\n");
> 			goto op_done;
> 		}
> 
> 		/* next state */
> 		vfop->state = BNX2X_VFOP_QCTOR_SETUP;
> 
> 		q_params->cmd = BNX2X_Q_CMD_INIT;
> 		vfop->rc = bnx2x_queue_state_change(bp, q_params);
> 
> 		bnx2x_vfop_finalize(vf, vfop->rc, VFOP_CONT); 

Hi Joe,

The `vfop' part of the code contains a lot of usage of the `bnx2x_vfop_finalize()',
which either goto or return at the end of almost every case.
"Normal" analysis tools/scripts fail to recognize them as  valid case breaks.

Adding `fallthrough' comments would make little sense, as this is not the real
behavior; Perhaps we need some alternative comment? (something in the line
of `macro case break')

Cheers,
Yuval


  reply	other threads:[~2013-12-14  6:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-13 23:01 Joe Perches
2013-12-14  6:16 ` Yuval Mintz [this message]
2013-12-14  6:57   ` Joe Perches
2013-12-14 13:26     ` Yuval Mintz
2013-12-14 17:49       ` Joe Perches

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=979A8436335E3744ADCD3A9F2A2B68A52AF1A735@SJEXCHMB10.corp.ad.broadcom.com \
    --to=yuvalmin@broadcom.com \
    --cc=ariele@broadcom.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@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

all inboxes | Powered by JetHome®