Re: [PATCH][next] greybus: Use fallthrough pseudo-keyword

From: Johan Hovold
Date: Wed Aug 05 2020 - 16:15:07 EST


On Wed, Aug 05, 2020 at 08:14:47AM -0500, Alex Elder wrote:
> On 7/28/20 5:37 PM, Alex Elder wrote:
> > On 7/27/20 1:32 PM, Gustavo A. R. Silva wrote:
> >> Replace the existing /* fall through */ comments and its variants with
> >> the new pseudo-keyword macro fallthrough[1].
> >>
> >> [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through
> >
> > Thanks for the patch.  It looks good, but it raises
> > another question I'd like discussion on.

Sorry about the late reply on this.

> It's been a week, and we heard back from Viresh (and Joe) on
> this, but no one else. Viresh left out the break statement on
> the last case of the switch statement intentionally, arguing
> that it is not needed (much like a return statement at the end
> of a void function). But he doesn't feel strongly enough
> insist it should stay that way. I'm sure the others omitted
> the break statement intentionally as well.

I really don't mind break statements in the final case and often do add
them, but I'm a bit reluctant to suggest that this is something that
need "fixing". There are a ton of these all over the kernel, and I think
we have too many opportunities for people to do mechanical clean ups
already.

Especially after Gustavo's work, the only real argument for adding them
is mostly moot as the compiler would catch it if anyone adds a new case
and forgets about the break statement.

> Given no strong pushback, I'll ask you (Gustavo) to post a
> second patch adding the missing break statements I described
> (and look for any others I might have missed). If you would
> prefer not to do that, just say so, and I will send out such
> a patch myself.

I'd probably just leave it as is, if only to not inspire others to send
copy-cat "fixes".

Johan