Re: [PATCH net v2] bonding: fix feature flag setting at init time

From: Jarod Wilson
Date: Wed Dec 02 2020 - 14:41:40 EST


On Wed, Dec 2, 2020 at 2:23 PM Jakub Kicinski <kuba@xxxxxxxxxx> wrote:
>
> On Wed, 2 Dec 2020 14:03:53 -0500 Jarod Wilson wrote:
> > On Wed, Dec 2, 2020 at 12:53 PM Jakub Kicinski <kuba@xxxxxxxxxx> wrote:
> > >
> > > On Wed, 2 Dec 2020 12:30:53 -0500 Jarod Wilson wrote:
> > > > + if (bond->dev->reg_state != NETREG_REGISTERED)
> > > > + goto noreg;
> > > > +
> > > > if (newval->value == BOND_MODE_ACTIVEBACKUP)
> > > > bond->dev->wanted_features |= BOND_XFRM_FEATURES;
> > > > else
> > > > bond->dev->wanted_features &= ~BOND_XFRM_FEATURES;
> > > > - netdev_change_features(bond->dev);
> > > > + netdev_update_features(bond->dev);
> > > > +noreg:
> > >
> > > Why the goto?
> >
> > Seemed cleaner to prevent an extra level of indentation of the code
> > following the goto and before the label, but I'm not that attached to
> > it if it's not wanted for coding style reasons.
>
> Yes, please don't use gotos where a normal if statement is sufficient.
> If you must avoid the indentation move the code to a helper.
>
> Also - this patch did not apply to net, please make sure you're
> developing on the correct base.

Argh, I must have been working in net-next instead of net, apologies.
Okay, I'll clarify the description per what Jay pointed out and adjust
the code to not include a goto, then make it on the right branch.

--
Jarod Wilson
jarod@xxxxxxxxxx