Re: [PATCH net] team: Move team device type change at the end of team_port_add

Nikola Z. Ivanov
2025-11-19T16:24:43Z

On Wed, Nov 19, 2025 at 05:10:15PM +0100, Jiri Pirko wrote:
> Tue, Nov 18, 2025 at 12:46:36PM +0100, pabeni@redhat.com wrote:
> >On 11/12/25 1:34 AM, Nikola Z. Ivanov wrote:
> >> @@ -1233,6 +1231,10 @@ static int team_port_add(struct team *team, struct net_device *port_dev,
> >> }
> >> }
> >>
> >> + err = team_dev_type_check_change(dev, port_dev);
> >> + if (err)
> >> + goto err_set_dev_type;
> >
> >Please don't add unneeded new labels, instead reuse the exiting
> >`err_set_slave_promisc`.
>
> Well, that is how error labels are done in team. "action" and
> "err_action" is always paired. Why to break this consistent pattern?

Hi Jiri,

This pattern is already broken in the same function by this:

/* set promiscuity level to new slave */
if (dev->flags & IFF_PROMISC) {
err = dev_set_promiscuity(port_dev, 1);
if (err)
goto err_set_slave_promisc;
}

/* set allmulti level to new slave */
if (dev->flags & IFF_ALLMULTI) {
err = dev_set_allmulti(port_dev, 1);
if (err) {
if (dev->flags & IFF_PROMISC)
dev_set_promiscuity(port_dev, -1);
goto err_set_slave_promisc;
}
}

So I guess I should also "break" it or do it as you've just
suggested and add another label "err_set_slave_allmulti"
so that we are at least consistent with this.

Thank you!