Re: [PATCH v2 6/6] media: i2c: Add driver for mlx7502x ToF sensor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Volodymyr,

I love your patch! Perhaps something to improve:

[auto build test WARNING on d8e8aa866ed8636fd6c1017c3d9453eab2922496]

url:    https://github.com/intel-lab-lkp/linux/commits/Volodymyr-Kharuk/media-i2c-mlx7502x-ToF-camera-support/20220714-163709
base:   d8e8aa866ed8636fd6c1017c3d9453eab2922496
config: hexagon-allyesconfig (https://download.01.org/0day-ci/archive/20220718/202207181432.DwoL0GPb-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 07022e6cf9b5b3baa642be53d0b3c3f1c403dbfd)
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/intel-lab-lkp/linux/commit/59a691c2f449518699a328ea663098aa3ae038b9
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Volodymyr-Kharuk/media-i2c-mlx7502x-ToF-camera-support/20220714-163709
        git checkout 59a691c2f449518699a328ea663098aa3ae038b9
        # 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=hexagon SHELL=/bin/bash drivers/media/i2c/ drivers/net/pcs/ kernel/trace/

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/media/i2c/mlx7502x.c:981:13: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           } else if (!on && sensor->streaming) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/mlx7502x.c:993:9: note: uninitialized use occurs here
           return ret;
                  ^~~
   drivers/media/i2c/mlx7502x.c:981:9: note: remove the 'if' if its condition is always true
           } else if (!on && sensor->streaming) {
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/media/i2c/mlx7502x.c:981:13: warning: variable 'ret' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
           } else if (!on && sensor->streaming) {
                      ^~~
   drivers/media/i2c/mlx7502x.c:993:9: note: uninitialized use occurs here
           return ret;
                  ^~~
   drivers/media/i2c/mlx7502x.c:981:13: note: remove the '&&' if its condition is always true
           } else if (!on && sensor->streaming) {
                      ^~~~~~
   drivers/media/i2c/mlx7502x.c:945:9: note: initialize the variable 'ret' to silence this warning
           int ret;
                  ^
                   = 0
   2 warnings generated.


vim +981 drivers/media/i2c/mlx7502x.c

   941	
   942	static int mlx7502x_s_stream(struct v4l2_subdev *sd, int on)
   943	{
   944		struct mlx7502x *sensor = to_mlx7502x(sd);
   945		int ret;
   946	
   947		mutex_lock(&sensor->lock);
   948	
   949		if (on && !sensor->streaming) {
   950			ret = pm_runtime_resume_and_get(sensor->dev);
   951			if (ret < 0) {
   952				mutex_unlock(&sensor->lock);
   953				return ret;
   954			}
   955	
   956			ret = __v4l2_ctrl_handler_setup(sd->ctrl_handler);
   957			if (ret < 0)
   958				goto error_stream;
   959			/* the registers below depends on hmax, which is configured in controls */
   960			ret = mlx7502x_set_link_freq(sensor);
   961			if (ret < 0)
   962				goto error_stream;
   963			ret = mlx7502x_update_output_format(sensor);
   964			if (ret < 0)
   965				goto error_stream;
   966			ret = mlx7502x_set_trigger_mode(sensor);
   967			if (ret < 0)
   968				goto error_stream;
   969	
   970			ret = mlx7502x_write8(sd, MLX7502X_STREAM_EN_REG, 1u);
   971			if (ret < 0)
   972				goto error_stream;
   973	
   974			sensor->streaming = 1u;
   975			dev_dbg(sensor->dev, "stream enabled\n");
   976	
   977			/* we need to wait to stabilize the system after streaming on */
   978			usleep_range(MLX7502X_STREAMING_DELAY_US, MLX7502X_STREAMING_DELAY_US + 10);
   979	
   980			gpiod_set_value_cansleep(sensor->leden, 1);
 > 981		} else if (!on && sensor->streaming) {
   982			gpiod_set_value_cansleep(sensor->leden, 0);
   983	
   984			sensor->streaming = 0u;
   985			ret = mlx7502x_write8(sd, MLX7502X_STREAM_EN_REG, 0u);
   986			dev_dbg(sensor->dev, "stream disabled\n");
   987	
   988			pm_runtime_mark_last_busy(sensor->dev);
   989			pm_runtime_put_autosuspend(sensor->dev);
   990		}
   991	
   992		mutex_unlock(&sensor->lock);
   993		return ret;
   994	
   995	error_stream:
   996		pm_runtime_put(sensor->dev);
   997		mutex_unlock(&sensor->lock);
   998		return ret;
   999	}
  1000	

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



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux