Re: [PATCH net-next v2] net: dsa: qca8k: Add 802.1q VLAN support

Vladimir Oltean
2020-07-30T21:10:27Z

On Thu, Jul 30, 2020 at 11:40:29AM +0100, Jonathan McDowell wrote:
> > > +
> > > + for (vid = vlan->vid_begin; vid <= vlan->vid_end && !ret; ++vid)
> > > + ret = qca8k_vlan_add(priv, port, vid, !untagged);
> > > +
> > > + if (ret)
> > > + dev_err(priv->dev, "Failed to add VLAN to port %d (%d)", port, ret);
> > > +
> >
> > If for some reason there is a temporary failure in qca8k_vlan_add, you'd
> > be swallowing it instead of printing the error and stopping the
> > execution.
>
> I don't follow; I'm breaking out of the for loop when we get an error? I
> figured that was a better move than potentially printing 4095 error
> messages if they were all going to fail.
>

Oh, you are. What an exotic way to write this loop, my brain stopped
parsing beyond "vid_end".

Thanks,
-Vladimir