Subject: RE: [PATCH net-next 1/2] net: txgbe: Add basic support for new AML devices

From: Jiawen Wu <[email-masked]>
Date: Mon, 13 Jan 2025 09:59:34 +0800

On Fri, Jan 10, 2025 8:04 PM, Simon Horman wrote:
> On Fri, Jan 10, 2025 at 04:42:48PM +0800, Jiawen Wu wrote:
> > There is a new 25/10 Gigabit Ethernet device.
> >
> > To support basic functions, PHYLINK is temporarily skipped as it is
> > intended to implement these configurations in the firmware. And the
> > associated link IRQ is also skipped.
> >
> > And Implement the new SW-FW interaction interface, which use 64 Byte
> > message buffer.
> >
> > Signed-off-by: Jiawen Wu <[email-masked]>
> 
> ...
> 
> > @@ -2719,7 +2730,7 @@ int wx_set_features(struct net_device *netdev, netdev_features_t features)
> >
> >  	netdev->features = features;
> >
> > -	if (wx->mac.type == wx_mac_sp && changed & NETIF_F_HW_VLAN_CTAG_RX)
> > +	if (changed & NETIF_F_HW_VLAN_CTAG_RX && wx->do_reset)
> >  		wx->do_reset(netdev);
> 
> Hi Jiawen Wu,
> 
> Here it is assumed that wx->do_reset may be NULL.  But there is an existing
> call to wx->do_reset(), near the end of this function, that is not
> conditional on wx->do_reset being non-NULL.  This does not seem consistent.
> 
> Flagged by Smatch.

That is conditional on WX_FLAG_FDIR_CAPABLE, which is set by txgbe (SP/AML).
Its condition is the same as wx->do_reset being non-NULL.

	if (!(test_bit(WX_FLAG_FDIR_CAPABLE, wx->flags)))
		return 0;

For ease of reading, I'll add "if (wx->do_reset)" near the end of this function.