Re: [PATCH] iio: chemical: scd4x: Add pressure compensation

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

 



Hi Roan,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Roan-van-Dijk/iio-chemical-scd4x-Add-pressure-compensation/20230704-170621
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link:    https://lore.kernel.org/r/20230704084706.370637-1-roan%40protonic.nl
patch subject: [PATCH] iio: chemical: scd4x: Add pressure compensation
config: x86_64-randconfig-m001-20230705 (https://download.01.org/0day-ci/archive/20230705/202307052018.7DV5CAOH-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230705/202307052018.7DV5CAOH-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
| Closes: https://lore.kernel.org/r/202307052018.7DV5CAOH-lkp@xxxxxxxxx/

smatch warnings:
drivers/iio/chemical/scd4x.c:385 scd4x_read_raw() error: uninitialized symbol 'ret'.
drivers/iio/chemical/scd4x.c:388 scd4x_read_raw() error: uninitialized symbol 'tmp'.

vim +/ret +385 drivers/iio/chemical/scd4x.c

49d22b695cbb69 Roan van Dijk 2021-10-08  335  static int scd4x_read_raw(struct iio_dev *indio_dev,
49d22b695cbb69 Roan van Dijk 2021-10-08  336  			struct iio_chan_spec const *chan, int *val,
49d22b695cbb69 Roan van Dijk 2021-10-08  337  			int *val2, long mask)
49d22b695cbb69 Roan van Dijk 2021-10-08  338  {
49d22b695cbb69 Roan van Dijk 2021-10-08  339  	struct scd4x_state *state = iio_priv(indio_dev);
49d22b695cbb69 Roan van Dijk 2021-10-08  340  	int ret;
49d22b695cbb69 Roan van Dijk 2021-10-08  341  	__be16 tmp;
49d22b695cbb69 Roan van Dijk 2021-10-08  342  
49d22b695cbb69 Roan van Dijk 2021-10-08  343  	switch (mask) {
49d22b695cbb69 Roan van Dijk 2021-10-08  344  	case IIO_CHAN_INFO_RAW:
49d22b695cbb69 Roan van Dijk 2021-10-08  345  		ret = iio_device_claim_direct_mode(indio_dev);
49d22b695cbb69 Roan van Dijk 2021-10-08  346  		if (ret)
49d22b695cbb69 Roan van Dijk 2021-10-08  347  			return ret;
49d22b695cbb69 Roan van Dijk 2021-10-08  348  
49d22b695cbb69 Roan van Dijk 2021-10-08  349  		mutex_lock(&state->lock);
49d22b695cbb69 Roan van Dijk 2021-10-08  350  		ret = scd4x_read_channel(state, chan->address);
49d22b695cbb69 Roan van Dijk 2021-10-08  351  		mutex_unlock(&state->lock);
49d22b695cbb69 Roan van Dijk 2021-10-08  352  
49d22b695cbb69 Roan van Dijk 2021-10-08  353  		iio_device_release_direct_mode(indio_dev);
49d22b695cbb69 Roan van Dijk 2021-10-08  354  		if (ret < 0)
49d22b695cbb69 Roan van Dijk 2021-10-08  355  			return ret;
49d22b695cbb69 Roan van Dijk 2021-10-08  356  
49d22b695cbb69 Roan van Dijk 2021-10-08  357  		*val = ret;
49d22b695cbb69 Roan van Dijk 2021-10-08  358  		return IIO_VAL_INT;
49d22b695cbb69 Roan van Dijk 2021-10-08  359  	case IIO_CHAN_INFO_SCALE:
e46e2512ac84bd Roan van Dijk 2021-10-21  360  		if (chan->type == IIO_CONCENTRATION) {
e46e2512ac84bd Roan van Dijk 2021-10-21  361  			*val = 0;
e46e2512ac84bd Roan van Dijk 2021-10-21  362  			*val2 = 100;
e46e2512ac84bd Roan van Dijk 2021-10-21  363  			return IIO_VAL_INT_PLUS_MICRO;
e46e2512ac84bd Roan van Dijk 2021-10-21  364  		} else if (chan->type == IIO_TEMP) {
49d22b695cbb69 Roan van Dijk 2021-10-08  365  			*val = 175000;
49d22b695cbb69 Roan van Dijk 2021-10-08  366  			*val2 = 65536;
49d22b695cbb69 Roan van Dijk 2021-10-08  367  			return IIO_VAL_FRACTIONAL;
49d22b695cbb69 Roan van Dijk 2021-10-08  368  		} else if (chan->type == IIO_HUMIDITYRELATIVE) {
49d22b695cbb69 Roan van Dijk 2021-10-08  369  			*val = 100000;
49d22b695cbb69 Roan van Dijk 2021-10-08  370  			*val2 = 65536;
49d22b695cbb69 Roan van Dijk 2021-10-08  371  			return IIO_VAL_FRACTIONAL;
49d22b695cbb69 Roan van Dijk 2021-10-08  372  		}
49d22b695cbb69 Roan van Dijk 2021-10-08  373  		return -EINVAL;
49d22b695cbb69 Roan van Dijk 2021-10-08  374  	case IIO_CHAN_INFO_OFFSET:
49d22b695cbb69 Roan van Dijk 2021-10-08  375  		*val = -16852;
49d22b695cbb69 Roan van Dijk 2021-10-08  376  		*val2 = 114286;
49d22b695cbb69 Roan van Dijk 2021-10-08  377  		return IIO_VAL_INT_PLUS_MICRO;
49d22b695cbb69 Roan van Dijk 2021-10-08  378  	case IIO_CHAN_INFO_CALIBBIAS:
49d22b695cbb69 Roan van Dijk 2021-10-08  379  		mutex_lock(&state->lock);
8e4a309948cffe Roan van Dijk 2023-07-04  380  		if (chan->type == IIO_TEMP)
49d22b695cbb69 Roan van Dijk 2021-10-08  381  			ret = scd4x_read(state, CMD_GET_TEMP_OFFSET, &tmp, sizeof(tmp));
8e4a309948cffe Roan van Dijk 2023-07-04  382  		else if (chan->type == IIO_PRESSURE)
8e4a309948cffe Roan van Dijk 2023-07-04  383  			ret = scd4x_read(state, CMD_GET_AMB_PRESSURE, &tmp, sizeof(tmp));

ret is uninitialized if type != IIO_TEMP and != IIO_PRESSURE.

49d22b695cbb69 Roan van Dijk 2021-10-08  384  		mutex_unlock(&state->lock);
49d22b695cbb69 Roan van Dijk 2021-10-08 @385  		if (ret)
49d22b695cbb69 Roan van Dijk 2021-10-08  386  			return ret;
49d22b695cbb69 Roan van Dijk 2021-10-08  387  
49d22b695cbb69 Roan van Dijk 2021-10-08 @388  		*val = be16_to_cpu(tmp);
49d22b695cbb69 Roan van Dijk 2021-10-08  389  
49d22b695cbb69 Roan van Dijk 2021-10-08  390  		return IIO_VAL_INT;
49d22b695cbb69 Roan van Dijk 2021-10-08  391  	default:
49d22b695cbb69 Roan van Dijk 2021-10-08  392  		return -EINVAL;
49d22b695cbb69 Roan van Dijk 2021-10-08  393  	}
49d22b695cbb69 Roan van Dijk 2021-10-08  394  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux