[jpirko-mlxsw:jiri_devel_lc_dev 7/10] drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:117:8: warning: variable 'flash_owner' is uninitialized when used here

From: kernel test robot
Date: Sat Jun 04 2022 - 07:00:42 EST


tree: https://github.com/jpirko/linux_mlxsw jiri_devel_lc_dev
head: e2de0017d7e8979fd196f786987bbb81a0ed3e9d
commit: a07ffbd025d76f046793282969a77fc55173b5e1 [7/10] mlxsw: core_linecards: Probe provisioned line cards for devices and expose FW version
config: arm64-buildonly-randconfig-r006-20220531 (https://download.01.org/0day-ci/archive/20220604/202206041845.0gXUtHQ7-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project b364c76683f8ef241025a9556300778c07b590c2)
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 arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://github.com/jpirko/linux_mlxsw/commit/a07ffbd025d76f046793282969a77fc55173b5e1
git remote add jpirko-mlxsw https://github.com/jpirko/linux_mlxsw
git fetch --no-tags jpirko-mlxsw jiri_devel_lc_dev
git checkout a07ffbd025d76f046793282969a77fc55173b5e1
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/net/ethernet/mellanox/mlxsw/

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

All warnings (new ones prefixed by >>):

>> drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:117:8: warning: variable 'flash_owner' is uninitialized when used here [-Wuninitialized]
if (!flash_owner) /* We care only about flashable ones. */
^~~~~~~~~~~
drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:99:19: note: initialize the variable 'flash_owner' to silence this warning
bool flash_owner;
^
= 0
1 warning generated.


vim +/flash_owner +117 drivers/net/ethernet/mellanox/mlxsw/core_linecards.c

89
90 static int mlxsw_linecard_device_info_update(struct mlxsw_linecard *linecard)
91 {
92 struct mlxsw_core *mlxsw_core = linecard->linecards->mlxsw_core;
93 bool flashable_found = false;
94 u8 msg_seq = 0;
95
96 do {
97 struct mlxsw_linecard_device_info info;
98 char mddq_pl[MLXSW_REG_MDDQ_LEN];
99 bool flash_owner;
100 bool data_valid;
101 u8 device_index;
102 int err;
103
104 mlxsw_reg_mddq_device_info_pack(mddq_pl, linecard->slot_index,
105 msg_seq);
106 err = mlxsw_reg_query(mlxsw_core, MLXSW_REG(mddq), mddq_pl);
107 if (err)
108 return err;
109 mlxsw_reg_mddq_device_info_unpack(mddq_pl, &msg_seq,
110 &data_valid, NULL,
111 &device_index,
112 &info.fw_major,
113 &info.fw_minor,
114 &info.fw_sub_minor);
115 if (!data_valid)
116 break;
> 117 if (!flash_owner) /* We care only about flashable ones. */
118 continue;
119 if (flashable_found) {
120 dev_warn_once(linecard->linecards->bus_info->dev, "linecard %u: More flashable devices present, exposing only the first one\n",
121 linecard->slot_index);
122 return 0;
123 }
124 linecard->device.info = info;
125 flashable_found = true;
126 } while (msg_seq);
127
128 return 0;
129 }
130

--
0-DAY CI Kernel Test Service
https://01.org/lkp