Re: [PATCH net-next v4 5/8] bridge: mrp: Update br_mrp to use new return values of br_mrp_switchdev

From: Horatiu Vultur
Date: Wed Feb 17 2021 - 11:21:14 EST


The 02/17/2021 10:59, Vladimir Oltean wrote:
>
> On Tue, Feb 16, 2021 at 10:42:02PM +0100, Horatiu Vultur wrote:
> > diff --git a/net/bridge/br_mrp.c b/net/bridge/br_mrp.c
> > index 01c67ed727a9..12487f6fe9b4 100644
> > --- a/net/bridge/br_mrp.c
> > +++ b/net/bridge/br_mrp.c
> > @@ -639,7 +639,7 @@ int br_mrp_set_ring_role(struct net_bridge *br,
> > struct br_mrp_ring_role *role)
> > {
> > struct br_mrp *mrp = br_mrp_find_id(br, role->ring_id);
> > - int err;
> > + enum br_mrp_hw_support support;
> >
> > if (!mrp)
> > return -EINVAL;
> > @@ -647,9 +647,9 @@ int br_mrp_set_ring_role(struct net_bridge *br,
> > mrp->ring_role = role->ring_role;
> >
> > /* If there is an error just bailed out */
> > - err = br_mrp_switchdev_set_ring_role(br, mrp, role->ring_role);
> > - if (err && err != -EOPNOTSUPP)
> > - return err;
> > + support = br_mrp_switchdev_set_ring_role(br, mrp, role->ring_role);
> > + if (support == BR_MRP_NONE)
> > + return -EOPNOTSUPP;
>
> It is broken to update the return type and value of a function in one
> patch, and check for the updated return value in another patch.
>

Yes, I will be more careful next time. I have tried to compile between
the patches and I have not see any issues here so I though that
everything is good.

> >
> > /* Now detect if the HW actually applied the role or not. If the HW
> > * applied the role it means that the SW will not to do those operations
> > @@ -657,7 +657,7 @@ int br_mrp_set_ring_role(struct net_bridge *br,
> > * SW when ring is open, but if the is not pushed to the HW the SW will
> > * need to detect when the ring is open
> > */
> > - mrp->ring_role_offloaded = err == -EOPNOTSUPP ? 0 : 1;
> > + mrp->ring_role_offloaded = support == BR_MRP_SW ? 0 : 1;
> >
> > return 0;
> > }

--
/Horatiu