[rmk-arm:zii 88/102] drivers/net/dsa/mv88e6xxx/serdes-6352.c:116:6: error: variable 'err' is used uninitialized whenever 'if' condition is false

From: kernel test robot
Date: Fri Nov 12 2021 - 13:41:17 EST


tree: git://git.armlinux.org.uk/~rmk/linux-arm zii
head: 2f38af1897a020adf10ab01d8dc20ea8388b564d
commit: b53990e2eebb53cba059843e3c6e93b3b0c10c59 [88/102] net: dsa: mv88e6xxx: convert 88e6352 to phylink_pcs *EXPERIMENTAL*
config: arm-buildonly-randconfig-r002-20211112 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c3dddeeafb529e769cde87bd29ef6271ac6bfa5c)
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 arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
git remote add rmk-arm git://git.armlinux.org.uk/~rmk/linux-arm
git fetch --no-tags rmk-arm zii
git checkout b53990e2eebb53cba059843e3c6e93b3b0c10c59
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

>> drivers/net/dsa/mv88e6xxx/serdes-6352.c:116:6: error: variable 'err' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (oldpage >= 0)
^~~~~~~~~~~~
drivers/net/dsa/mv88e6xxx/serdes-6352.c:120:53: note: uninitialized use occurs here
return marvell_c22_pcs_restore_page(mpcs, oldpage, err);
^~~
drivers/net/dsa/mv88e6xxx/serdes-6352.c:116:2: note: remove the 'if' if its condition is always true
if (oldpage >= 0)
^~~~~~~~~~~~~~~~~
drivers/net/dsa/mv88e6xxx/serdes-6352.c:113:18: note: initialize the variable 'err' to silence this warning
int oldpage, err;
^
= 0
drivers/net/dsa/mv88e6xxx/serdes-6352.c:189:6: error: variable 'err' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (oldpage >= 0)
^~~~~~~~~~~~
drivers/net/dsa/mv88e6xxx/serdes-6352.c:193:53: note: uninitialized use occurs here
return marvell_c22_pcs_restore_page(mpcs, oldpage, err);
^~~
drivers/net/dsa/mv88e6xxx/serdes-6352.c:189:2: note: remove the 'if' if its condition is always true
if (oldpage >= 0)
^~~~~~~~~~~~~~~~~
drivers/net/dsa/mv88e6xxx/serdes-6352.c:182:23: note: initialize the variable 'err' to silence this warning
int oldpage, adv, err;
^
= 0
2 errors generated.


vim +116 drivers/net/dsa/mv88e6xxx/serdes-6352.c

109
110 static int marvell_c22_pcs_modify(struct marvell_c22_pcs *mpcs, u8 reg,
111 u16 mask, u16 val)
112 {
113 int oldpage, err;
114
115 oldpage = marvell_c22_pcs_set_fiber_page(mpcs);
> 116 if (oldpage >= 0)
117 err = __mdiobus_modify(mpcs->mdio.bus, mpcs->mdio.addr,
118 reg, mask, val);
119
120 return marvell_c22_pcs_restore_page(mpcs, oldpage, err);
121 }
122

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip