Re: [PATCH net-next v3 1/3] net: stmmac: split xPCS setup from mdio register
From: kernel test robot <hidden>
Date: 2021-05-27 16:40:06
Also in:
oe-kbuild-all
Hi Michael, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on net-next/master] url: https://github.com/0day-ci/linux/commits/Michael-Sit-Wei-Hong/Enable-2-5Gbps-speed-for-stmmac/20210527-173057 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 59c56342459a483d5e563ed8b5fdb77ab7622a73 config: x86_64-randconfig-r013-20210526 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 6505c630407c5feec818f0bb1c284f9eeebf2071) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install x86_64 cross compiling tool for clang build # apt-get install binutils-x86-64-linux-gnu # https://github.com/0day-ci/linux/commit/00cb836e57c674c038314b655ec92243ac43dad9 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Michael-Sit-Wei-Hong/Enable-2-5Gbps-speed-for-stmmac/20210527-173057 git checkout 00cb836e57c674c038314b655ec92243ac43dad9 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <redacted> All warnings (new ones prefixed by >>):
quoted
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c:419:17: warning: variable 'found' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
for (addr = 0; addr < max_addr; addr++) {
^~~~~~~~~~~~~~~
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c:429:7: note: uninitialized use occurs here
if (!found) {
^~~~~
include/linux/compiler.h:56:47: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^~~~
include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c:419:17: note: remove the condition if it is always true
for (addr = 0; addr < max_addr; addr++) {
^~~~~~~~~~~~~~~
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c:402:33: note: initialize the variable 'found' to silence this warning
int mode, max_addr, addr, found, ret;
^
= 0
1 warning generated.
vim +419 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
399
400 int stmmac_xpcs_setup(struct mii_bus *bus)
401 {
402 int mode, max_addr, addr, found, ret;
403 struct net_device *ndev = bus->priv;
404 struct mdio_xpcs_args *xpcs;
405 struct stmmac_priv *priv;
406
407 priv = netdev_priv(ndev);
408 xpcs = &priv->hw->xpcs_args;
409 mode = priv->plat->phy_interface;
410 max_addr = PHY_MAX_ADDR;
411
412 priv->hw->xpcs = mdio_xpcs_get_ops();
413 if (!priv->hw->xpcs)
414 return -ENODEV;
415
416 /* Try to probe the XPCS by scanning all addresses. */
417 xpcs->bus = bus;
418
> 419 for (addr = 0; addr < max_addr; addr++) {
420 xpcs->addr = addr;
421
422 ret = stmmac_xpcs_probe(priv, xpcs, mode);
423 if (!ret) {
424 found = 1;
425 break;
426 }
427 }
428
429 if (!found) {
430 dev_warn(priv->device, "No xPCS found\n");
431 return -ENODEV;
432 }
433
434 return ret;
435 }
436
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Attachments
- .config.gz [application/gzip] 34759 bytes