[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <00d601dac15e$f9ba3e70$ed2ebb50$@trustnetic.com>
Date: Tue, 18 Jun 2024 17:07:42 +0800
From: Jiawen Wu <jiawenwu@...stnetic.com>
To: "'Simon Horman'" <horms@...nel.org>
Cc: <davem@...emloft.net>,
<edumazet@...gle.com>,
<kuba@...nel.org>,
<pabeni@...hat.com>,
<linux@...linux.org.uk>,
<andrew@...n.ch>,
<netdev@...r.kernel.org>,
<mengyuanlou@...-swift.com>
Subject: RE: [PATCH net-next v2 2/3] net: txgbe: support Flow Director perfect filters
> > > + /* only program filters to hardware if the net device is running, as
> > > + * we store the filters in the Rx buffer which is not allocated when
> > > + * the device is down
> > > + */
> > > + if (netif_running(wx->netdev)) {
> > > + err = txgbe_fdir_write_perfect_filter(wx, &input->filter,
> > > + input->sw_idx, queue);
> > > + if (err)
> > > + goto err_unlock;
> > > + }
> > > +
> > > + txgbe_update_ethtool_fdir_entry(txgbe, input, input->sw_idx);
> > > +
> > > + spin_unlock(&txgbe->fdir_perfect_lock);
> > > +
> > > + return err;
> >
> > Hi Jiawen Wu,
> >
> > Smatch flags that err may be used uninitialised here.
> > I'm unsure if that can occur in practice, but perhaps it
> > would be nicer to simply return 0 here.
Perhaps initialize err = -EINVAL, and return 0 here.
> >
> > > +err_unlock:
> > > + spin_unlock(&txgbe->fdir_perfect_lock);
> > > +err_out:
> > > + kfree(input);
> > > + return -EINVAL;
> >
> > And conversely, perhaps it would be nicer to return err here - ensuring is
> > it always set. F.e. this would propagate the error code returned by
> > txgbe_fdir_write_perfect_filter().
>
> I think it can be changed to initialize err = 0, and return err in these two places.
Then return err here.
Powered by blists - more mailing lists