public inbox for dccp@vger.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@netronome.com>
To: dccp@vger.kernel.org
Subject: Re: [oss-drivers] [trivial PATCH] treewide: Convert switch/case fallthrough; to break;
Date: Thu, 17 Sep 2020 08:03:35 +0000	[thread overview]
Message-ID: <20200917080334.GB5769@netronome.com> (raw)
In-Reply-To: <e6387578c75736d61b2fe70d9783d91329a97eb4.camel@perches.com>

On Wed, Sep 09, 2020 at 01:06:39PM -0700, Joe Perches wrote:
> fallthrough to a separate case/default label break; isn't very readable.
> 
> Convert pseudo-keyword fallthrough; statements to a simple break; when
> the next label is case or default and the only statement in the next
> label block is break;
> 
> Found using:
> 
> $ grep-2.5.4 -rP --include=*.[ch] -n "fallthrough;(\s*(case\s+\w+|default)\s*:\s*){1,7}break;" *
> 
> Miscellanea:
> 
> o Move or coalesce a couple label blocks above a default: block.
> 
> Signed-off-by: Joe Perches <joe@perches.com>

...

> diff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c
> index 252fe06f58aa..1d5b87079104 100644
> --- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c
> +++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c
> @@ -345,7 +345,7 @@ static int matching_bar(struct nfp_bar *bar, u32 tgt, u32 act, u32 tok,
>  		baract = NFP_CPP_ACTION_RW;
>  		if (act = 0)
>  			act = NFP_CPP_ACTION_RW;
> -		fallthrough;
> +		break;
>  	case NFP_PCIE_BAR_PCIE2CPP_MapType_FIXED:
>  		break;
>  	default:

This is a cascading fall-through handling all map types.
I don't think this change improves readability.

...

  parent reply	other threads:[~2020-09-17  8:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-09 20:06 [trivial PATCH] treewide: Convert switch/case fallthrough; to break; Joe Perches
2020-09-09 20:38 ` Gustavo A. R. Silva
2020-09-09 20:55 ` Keith Busch
2020-09-09 22:36 ` Jason Gunthorpe
2020-09-09 22:47 ` Joe Perches
2020-09-10  6:28 ` Mauro Carvalho Chehab
2020-09-10  6:53 ` Wolfram Sang
2020-09-10  8:24 ` Nicolas.Ferre
2020-09-10  8:47 ` Felipe Balbi
2020-09-10  9:18 ` Steffen Maier
2020-09-10  9:24 ` Ilya Dryomov
2020-09-10 10:16 ` Matthias Brugger
2020-09-10 14:21 ` Robin Murphy
2020-09-11  4:19 ` Joe Perches
2020-09-15  9:19 ` Miquel Raynal
2020-09-17  8:03 ` Simon Horman [this message]
2020-09-17 19:40 ` Jacob Keller

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=20200917080334.GB5769@netronome.com \
    --to=simon.horman@netronome.com \
    --cc=dccp@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