lkml.org 
[lkml]   [2013]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: bnx2x_sriov.c: Missing switch/case breaks?
Date
> > > 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.
> > >
> > Hi Joe,
>
> Hi Yuval.
>
> > 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')
>
> No idea. It's certainly an ugly macro.
>

True.

> This does have a fallthrough path though when
> (rc == 0 && next == VFOP_VERIFY_PEND) so

This is a very rare path - there's exactly one place in the bnx2x code
Where `next == VFOP_VERIFY_PEND' (also notice this path prints an
error, so this is obviously not the expected behaviour).

> maybe there should be a break after most all
> uses of this macro anyway. When next is

Won't some static code analysis tools regard such `break' calls as
unreachable code?

> VFOP_VERIFY_PEND, then a "fall-through" comment
> would be appropriate.
>
> cheers, Joe

Thanks,
Yuval


\
 
 \ /
  Last update: 2013-12-14 15:01    [W:0.049 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site