linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Joe Perches <joe@perches.com>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org,
	Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH][next] Input: Fix fall-through warning for Clang
Date: Mon, 14 Jun 2021 15:12:31 -0700	[thread overview]
Message-ID: <YMfUT7pvBWreiR1K@google.com> (raw)
In-Reply-To: <91eef5ab3143ae8fadb8eb2969aecba5f3e7ad98.camel@perches.com>

Hi Joe,

On Mon, Jun 07, 2021 at 03:02:40PM -0700, Joe Perches wrote:
> On Mon, 2021-06-07 at 16:48 -0500, Gustavo A. R. Silva wrote:
> > In preparation to enable -Wimplicit-fallthrough for Clang, fix a
> > warning by explicitly adding a fallthrough; statement.
> []
> > diff --git a/drivers/input/joystick/sidewinder.c b/drivers/input/joystick/sidewinder.c
> []
> > @@ -660,6 +660,7 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv)
> >  					fallthrough;
> >  				case 45:				/* Ambiguous packet length */
> >  					if (j <= 40) {			/* ID length less or eq 40 -> FSP */
> > +					fallthrough;
> >  				case 43:
> >  						sw->type = SW_ID_FSP;
> >  						break;
> 
> Yuck.  Super ugly.  There's no need to play games with indentation.

Yeah, the original code is not pretty :(

> 
> Perhaps the simpler:
> 
> 				case 43:
> 					sw->type = SW_ID_FSP;
> 					break;
> 				case 45:				/* Ambiguous packet length */
> 					if (j <= 40) {			/* ID length less or eq 40 -> FSP */
> 						sw->type = SW_ID_FSP;
> 						break;
> 					}
> 					sw->number++;
> 					fallthrough;
> 
> 

Could you resubmit this version properly formatted?

Thanks.
 
-- 
Dmitry

  reply	other threads:[~2021-06-14 22:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07 21:48 [PATCH][next] Input: Fix fall-through warning for Clang Gustavo A. R. Silva
2021-06-07 22:02 ` Joe Perches
2021-06-14 22:12   ` Dmitry Torokhov [this message]
2021-06-29 14:05     ` Gustavo A. R. Silva

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=YMfUT7pvBWreiR1K@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=gustavoars@kernel.org \
    --cc=joe@perches.com \
    --cc=keescook@chromium.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-input@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).