On Wed, Dec 02, 2015 at 10:27:53AM +0900, Simon Horman wrote:
> On Tue, Dec 01, 2015 at 10:39:04AM -0800, Ben Pfaff wrote:
> > Code earlier in this function validated that gm->type is valid, so there's
> > no need for a default case at the end of the function.  Keeping the default
> > case as an abort could potentially introduce a bug later, if the code
> > happened to be blindly cut-and-pasted somewhere else.
> > 
> > CC: Flavio Leitner <f...@sysclose.org>
> > Signed-off-by: Ben Pfaff <b...@ovn.org>
> > ---
> >  lib/ofp-util.c | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/lib/ofp-util.c b/lib/ofp-util.c
> > index 2141144..5a0d31d 100644
> > --- a/lib/ofp-util.c
> > +++ b/lib/ofp-util.c
> > @@ -8879,8 +8879,6 @@ ofputil_decode_group_mod(const struct ofp_header *oh,
> >                  return OFPERR_OFPGMFC_INVALID_GROUP;
> >              }
> >              break;
> > -        default:
> > -            OVS_NOT_REACHED();
> >          }
> >      }
> 
> My concern is that if it is cut-and pasted without the earlier code
> that verifies gm->type then there may be an case which isn't handled.
> Could we add a comment? In that case I would be comfortable
> with deleting the code though personally I lean towards leaving it.
> 

I think I'm just going to drop this.  One can't defend against all
coding errors.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to