[PATCH net-next 3/3] net: stmmac: add glue layer for T-HEAD TH1520 SoC

kernel test robot lkp at intel.com
Thu Aug 24 08:06:07 PDT 2023


Hi Jisheng,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Jisheng-Zhang/dt-bindings-net-snps-dwmac-allow-dwmac-3-70a-to-set-pbl-properties/20230821-114902
base:   net-next/main
patch link:    https://lore.kernel.org/r/20230820120213.2054-4-jszhang%40kernel.org
patch subject: [PATCH net-next 3/3] net: stmmac: add glue layer for T-HEAD TH1520 SoC
config: arm64-allyesconfig (https://download.01.org/0day-ci/archive/20230824/202308242250.G39QxvdR-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce: (https://download.01.org/0day-ci/archive/20230824/202308242250.G39QxvdR-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308242250.G39QxvdR-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c:151:3: warning: variable 'div' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
     151 |                 default:
         |                 ^~~~~~~
   drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c:156:50: note: uninitialized use occurs here
     156 |                                    GMAC_PLLCLK_DIV_MASK, GMAC_PLLCLK_DIV_NUM(div));
         |                                                                              ^~~
   drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c:40:68: note: expanded from macro 'GMAC_PLLCLK_DIV_NUM'
      40 | #define  GMAC_PLLCLK_DIV_NUM(x)         FIELD_PREP(GMAC_PLLCLK_DIV_MASK, (x))
         |                                                                           ^
   include/linux/bitfield.h:114:33: note: expanded from macro 'FIELD_PREP'
     114 |                 __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: ");    \
         |                                               ^~~~
   include/linux/bitfield.h:68:41: note: expanded from macro '__BF_FIELD_CHECK'
      68 |                 BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ?           \
         |                                                       ^~~~
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:397:22: note: expanded from macro 'compiletime_assert'
     397 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |                             ^~~~~~~~~
   include/linux/compiler_types.h:385:23: note: expanded from macro '_compiletime_assert'
     385 |         __compiletime_assert(condition, msg, prefix, suffix)
         |                              ^~~~~~~~~
   include/linux/compiler_types.h:377:9: note: expanded from macro '__compiletime_assert'
     377 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c:121:9: note: initialize the variable 'div' to silence this warning
     121 |         u32 div;
         |                ^
         |                 = 0
   1 warning generated.


vim +/div +151 drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c

   115	
   116	static void thead_dwmac_fix_speed(void *priv, unsigned int speed, unsigned int mode)
   117	{
   118		struct thead_dwmac *dwmac = priv;
   119		struct plat_stmmacenet_data *plat = dwmac->plat;
   120		unsigned long rate;
   121		u32 div;
   122	
   123		switch (plat->interface) {
   124		/* For MII, rxc/txc is provided by phy */
   125		case PHY_INTERFACE_MODE_MII:
   126			return;
   127	
   128		case PHY_INTERFACE_MODE_RGMII:
   129		case PHY_INTERFACE_MODE_RGMII_ID:
   130		case PHY_INTERFACE_MODE_RGMII_RXID:
   131		case PHY_INTERFACE_MODE_RGMII_TXID:
   132			rate = clk_get_rate(plat->stmmac_clk);
   133			if (!rate || rate % GMAC_GMII_RGMII_RATE != 0 ||
   134			    rate % GMAC_MII_RATE != 0) {
   135				dev_err(dwmac->dev, "invalid gmac rate %ld\n", rate);
   136				return;
   137			}
   138	
   139			regmap_update_bits(dwmac->apb_regmap, GMAC_PLLCLK_DIV, GMAC_PLLCLK_DIV_EN, 0);
   140	
   141			switch (speed) {
   142			case SPEED_1000:
   143				div = rate / GMAC_GMII_RGMII_RATE;
   144				break;
   145			case SPEED_100:
   146				div = rate / GMAC_MII_RATE;
   147				break;
   148			case SPEED_10:
   149				div = rate * 10 / GMAC_MII_RATE;
   150				break;
 > 151			default:
   152				dev_err(dwmac->dev, "invalid speed %u\n", speed);
   153				break;
   154			}
   155			regmap_update_bits(dwmac->apb_regmap, GMAC_PLLCLK_DIV,
   156					   GMAC_PLLCLK_DIV_MASK, GMAC_PLLCLK_DIV_NUM(div));
   157	
   158			regmap_update_bits(dwmac->apb_regmap, GMAC_PLLCLK_DIV,
   159					   GMAC_PLLCLK_DIV_EN, GMAC_PLLCLK_DIV_EN);
   160			break;
   161		default:
   162			dev_err(dwmac->dev, "unsupported phy interface %d\n",
   163				plat->interface);
   164			return;
   165		}
   166	}
   167	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



More information about the linux-riscv mailing list