Re: bnx2x_sriov.c: Missing switch/case breaks?

From: Joe Perches
Date: Sat Dec 14 2013 - 12:50:18 EST


On Sat, 2013-12-14 at 13:26 +0000, Yuval Mintz wrote:
> > > 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.
[]
> > 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?

I suppose that maybe true,
but this could also work...

bnx2x_vfop_finalize(vf, vfop->rc, VFOP_CONT);
/* Ugly goto|return macro, not fall-through */

;)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/