[xilinx-xlnx:xlnx_rebase_v5.15_LTS 231/1029] drivers/net/ethernet/xilinx/xilinx_tsn_switch.c:597:13: warning: variable 'pmap' is used uninitialized whenever 'if' condition is false

kernel test robot lkp at intel.com
Sun Mar 27 13:09:15 PDT 2022


Hi Saurabh,

FYI, the error/warning still remains.

tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15_LTS
head:   1870e0fa79a9d58c6748c34550f3ccea0b515933
commit: a7ae7ddafe91c16d0f4bcd4d148c76318f3cfb06 [231/1029] net: xilinx: Add support for PL TSN IP features
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20220328/202203280456.kzjSjx7T-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d)
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/Xilinx/linux-xlnx/commit/a7ae7ddafe91c16d0f4bcd4d148c76318f3cfb06
        git remote add xilinx-xlnx https://github.com/Xilinx/linux-xlnx
        git fetch --no-tags xilinx-xlnx xlnx_rebase_v5.15_LTS
        git checkout a7ae7ddafe91c16d0f4bcd4d148c76318f3cfb06
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All warnings (new ones prefixed by >>):

>> drivers/net/ethernet/xilinx/xilinx_tsn_switch.c:597:13: warning: variable 'pmap' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           } else if (num_q == 2) {
                      ^~~~~~~~~~
   drivers/net/ethernet/xilinx/xilinx_tsn_switch.c:602:36: note: uninitialized use occurs here
           axienet_iow(&lp, XAS_PMAP_OFFSET, pmap);
                                             ^~~~
   drivers/net/ethernet/xilinx/xilinx_tsn_switch.c:597:9: note: remove the 'if' if its condition is always true
           } else if (num_q == 2) {
                  ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/xilinx/xilinx_tsn_switch.c:579:10: note: initialize the variable 'pmap' to silence this warning
           u32 pmap;
                   ^
                    = 0
   1 warning generated.


vim +597 drivers/net/ethernet/xilinx/xilinx_tsn_switch.c

   576	
   577	static int tsn_switch_cam_init(u16 num_q)
   578	{
   579		u32 pmap;
   580		u32 timeout = 20000;
   581	
   582		/* wait for switch init done */
   583		while (!(axienet_ior(&lp, XAS_STATUS_OFFSET) &
   584			SDL_CAM_WR_ENABLE) && timeout)
   585			timeout--;
   586	
   587		if (!timeout)
   588			pr_warn("Switch init took longer time!!");
   589	
   590		if (num_q == 3) {
   591		/* map pcp = 2,3 to queue1
   592		 *     pcp = 4 to queue2
   593		 */
   594			pmap = ((PMAP_EGRESS_QUEUE1_SELECT << PMAP_PRIORITY2_SHIFT) |
   595				(PMAP_EGRESS_QUEUE1_SELECT << PMAP_PRIORITY3_SHIFT) |
   596				(PMAP_EGRESS_QUEUE2_SELECT << PMAP_PRIORITY4_SHIFT));
 > 597		} else if (num_q == 2) {
   598			/*     pcp = 4 to queue1 */
   599			pmap = (PMAP_EGRESS_QUEUE1_SELECT << PMAP_PRIORITY4_SHIFT);
   600		}
   601	
   602		axienet_iow(&lp, XAS_PMAP_OFFSET, pmap);
   603	
   604		timeout = 20000;
   605		/* wait for cam init done */
   606		while (!(axienet_ior(&lp, XAS_SDL_CAM_STATUS_OFFSET) &
   607			SDL_CAM_WR_ENABLE) && timeout)
   608			timeout--;
   609	
   610		if (!timeout)
   611			pr_warn("CAM init took longer time!!");
   612	
   613		return 0;
   614	}
   615	

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



More information about the linux-arm-kernel mailing list