[xilinx-xlnx:xlnx_rebase_v5.15_LTS 794/1181] drivers/media/i2c/ap1302.c:1829:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true

kernel test robot lkp at intel.com
Mon Jun 20 08:44:10 PDT 2022


tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15_LTS
head:   59523b5c4aca0174f1f8cba2a07d3b3328b7c80e
commit: b0d8c0539b1bde057e9dafa153ffc0e98d7631e8 [794/1181] media: i2c: Add ON Semiconductor AP1302 ISP driver
config: i386-allmodconfig (https://download.01.org/0day-ci/archive/20220620/202206202317.ugyVbIJa-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project af6d2a0b6825e71965f3e2701a63c239fa0ad70f)
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
        # https://github.com/Xilinx/linux-xlnx/commit/b0d8c0539b1bde057e9dafa153ffc0e98d7631e8
        git remote add xilinx-xlnx https://github.com/Xilinx/linux-xlnx
        git fetch --no-tags xilinx-xlnx xlnx_rebase_v5.15_LTS
        git checkout b0d8c0539b1bde057e9dafa153ffc0e98d7631e8
        # 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=i386 SHELL=/bin/bash drivers/media/i2c/ drivers/phy/xilinx/ drivers/staging/

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

All warnings (new ones prefixed by >>):

>> drivers/media/i2c/ap1302.c:1829:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (enable == ap1302->streaming)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/ap1302.c:1845:6: note: uninitialized use occurs here
           if (ret < 0)
               ^~~
   drivers/media/i2c/ap1302.c:1829:2: note: remove the 'if' if its condition is always false
           if (enable == ap1302->streaming)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/ap1302.c:1825:9: note: initialize the variable 'ret' to silence this warning
           int ret;
                  ^
                   = 0
   1 warning generated.


vim +1829 drivers/media/i2c/ap1302.c

  1821	
  1822	static int ap1302_s_stream(struct v4l2_subdev *sd, int enable)
  1823	{
  1824		struct ap1302_device *ap1302 = to_ap1302(sd);
  1825		int ret;
  1826	
  1827		mutex_lock(&ap1302->lock);
  1828	
> 1829		if (enable == ap1302->streaming)
  1830			goto done;
  1831	
  1832		if (enable) {
  1833			ret = ap1302_configure(ap1302);
  1834			if (ret < 0)
  1835				goto done;
  1836	
  1837			ret = ap1302_stall(ap1302, false);
  1838		} else {
  1839			ret = ap1302_stall(ap1302, true);
  1840		}
  1841	
  1842	done:
  1843		mutex_unlock(&ap1302->lock);
  1844	
  1845		if (ret < 0)
  1846			dev_err(ap1302->dev, "Failed to %s stream: %d\n",
  1847				enable ? "start" : "stop", ret);
  1848	
  1849		return ret;
  1850	}
  1851	

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



More information about the linux-arm-kernel mailing list