[PATCH net-next 09/11] net: stmmac: ingenic: simplify x2000 mac_set_mode()

Russell King (Oracle) linux at armlinux.org.uk
Wed Nov 5 17:55:31 PST 2025


On Wed, Nov 05, 2025 at 05:18:48PM -0800, Jakub Kicinski wrote:
> On Wed, 05 Nov 2025 13:26:53 +0000 Russell King (Oracle) wrote:
> > As per the previous commit, we have validated that the phy_intf_sel
> > value is one that is permissible for this SoC, so there is no need to
> > handle invalid PHY interface modes. We can also apply the other
> > configuration based upon the phy_intf_sel value rather than the
> > PHY interface mode.
> 
> clang sayeth:
> 
> drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c:128:13: warning: variable 'val' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
>   128 |         } else if (phy_intf_sel == PHY_INTF_SEL_RGMII) {
>       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Clang can't know that phy_intf_sel will only ever be one of
PHY_INTF_SEL_RMII or PHY_INTF_SEL_RGMII here (its already been
validated as such by the only caller of this function.)

I guess the way around this warning is to move:

        val |= FIELD_PREP(MACPHYC_PHY_INFT_MASK, phy_intf_sel);

up and make it a simple assignment, and make the others |=.

That's the code I originally had before I attempted to minimise the
noise in the patches. :(

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!



More information about the linux-arm-kernel mailing list