lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202502280702.31rbuGw8-lkp@intel.com>
Date: Fri, 28 Feb 2025 07:34:14 +0800
From: kernel test robot <lkp@...el.com>
To: Alisa-Dariana Roman <alisadariana@...il.com>,
	Alisa-Dariana Roman <alisa.roman@...log.com>,
	"Rob Herring (Arm)" <robh@...nel.org>,
	Jonathan Cameron <Jonathan.Cameron@...wei.com>,
	Ramona Gradinariu <ramona.bolboaca13@...il.com>,
	David Lechner <dlechner@...libre.com>, linux-iio@...r.kernel.org,
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-doc@...r.kernel.org
Cc: llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
	Lars-Peter Clausen <lars@...afoo.de>,
	Michael Hennerich <Michael.Hennerich@...log.com>,
	Krzysztof Kozlowski <krzk@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Jonathan Corbet <corbet@....net>
Subject: Re: [PATCH v5 2/3] iio: adc: ad7191: add AD7191

Hi Alisa-Dariana,

kernel test robot noticed the following build warnings:

[auto build test WARNING on jic23-iio/togreg]
[also build test WARNING on robh/for-next linus/master v6.14-rc4 next-20250227]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Alisa-Dariana-Roman/dt-bindings-iio-adc-add-AD7191/20250226-195853
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link:    https://lore.kernel.org/r/20250226115451.249361-3-alisa.roman%40analog.com
patch subject: [PATCH v5 2/3] iio: adc: ad7191: add AD7191
config: hexagon-allyesconfig (https://download.01.org/0day-ci/archive/20250228/202502280702.31rbuGw8-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250228/202502280702.31rbuGw8-lkp@intel.com/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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502280702.31rbuGw8-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/iio/adc/ad7191.c:217:15: warning: variable 'pga_index' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
     217 |                 for (i = 0; i < ARRAY_SIZE(gain); i++) {
         |                             ^~~~~~~~~~~~~~~~~~~~
   drivers/iio/adc/ad7191.c:224:35: note: uninitialized use occurs here
     224 |                 st->scale_avail = &scale_buffer[pga_index];
         |                                                 ^~~~~~~~~
   drivers/iio/adc/ad7191.c:217:15: note: remove the condition if it is always true
     217 |                 for (i = 0; i < ARRAY_SIZE(gain); i++) {
         |                             ^~~~~~~~~~~~~~~~~~~~
   drivers/iio/adc/ad7191.c:160:48: note: initialize the variable 'pga_index' to silence this warning
     160 |         int odr_value, odr_index, pga_value, pga_index, i, ret;
         |                                                       ^
         |                                                        = 0
>> drivers/iio/adc/ad7191.c:179:15: warning: variable 'odr_index' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
     179 |                 for (i = 0; i < ARRAY_SIZE(samp_freq); i++) {
         |                             ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/adc/ad7191.c:186:36: note: uninitialized use occurs here
     186 |                 st->samp_freq_avail = &samp_freq[odr_index];
         |                                                  ^~~~~~~~~
   drivers/iio/adc/ad7191.c:179:15: note: remove the condition if it is always true
     179 |                 for (i = 0; i < ARRAY_SIZE(samp_freq); i++) {
         |                             ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/adc/ad7191.c:160:26: note: initialize the variable 'odr_index' to silence this warning
     160 |         int odr_value, odr_index, pga_value, pga_index, i, ret;
         |                                 ^
         |                                  = 0
   drivers/iio/adc/ad7191.c:553:18: error: expected ';' after top level declarator
     553 | MODULE_IMPORT_NS(IIO_AD_SIGMA_DELTA);
         |                  ^
   2 warnings and 1 error generated.


vim +217 drivers/iio/adc/ad7191.c

   150	
   151	static int ad7191_config_setup(struct iio_dev *indio_dev)
   152	{
   153		struct ad7191_state *st = iio_priv(indio_dev);
   154		struct device *dev = &st->sd.spi->dev;
   155		/* Sampling frequencies in Hz, see Table 5 */
   156		static const u32 samp_freq[4] = { 120, 60, 50, 10 };
   157		/* Gain options, see Table 7 */
   158		const u32 gain[4] = { 1, 8, 64, 128 };
   159		static u32 scale_buffer[4][2];
   160		int odr_value, odr_index, pga_value, pga_index, i, ret;
   161		u64 scale_uv;
   162	
   163		st->samp_freq_index = 0;
   164		st->scale_index = 0;
   165	
   166		ret = device_property_read_u32(dev, "adi,odr-value", &odr_value);
   167		if (ret && ret != -EINVAL)
   168			return dev_err_probe(dev, ret, "Failed to get odr value.\n");
   169	
   170		if (ret == -EINVAL) {
   171			st->odr_gpios = devm_gpiod_get_array(dev, "odr", GPIOD_OUT_LOW);
   172			if (IS_ERR(st->odr_gpios))
   173				return dev_err_probe(dev, PTR_ERR(st->odr_gpios),
   174						     "Failed to get odr gpios.\n");
   175	
   176			st->samp_freq_avail = samp_freq;
   177			st->samp_freq_avail_size = ARRAY_SIZE(samp_freq);
   178		} else {
 > 179			for (i = 0; i < ARRAY_SIZE(samp_freq); i++) {
   180				if (odr_value != samp_freq[i])
   181					continue;
   182				odr_index = i;
   183				break;
   184			}
   185	
   186			st->samp_freq_avail = &samp_freq[odr_index];
   187			st->samp_freq_avail_size = 1;
   188	
   189			st->odr_gpios = NULL;
   190		}
   191	
   192		mutex_lock(&st->lock);
   193	
   194		for (i = 0; i < ARRAY_SIZE(scale_buffer); i++) {
   195			scale_uv = ((u64)st->int_vref_mv * NANO) >>
   196				(indio_dev->channels[0].scan_type.realbits - 1);
   197			do_div(scale_uv, gain[i]);
   198			scale_buffer[i][1] = do_div(scale_uv, NANO);
   199			scale_buffer[i][0] = scale_uv;
   200		}
   201	
   202		mutex_unlock(&st->lock);
   203	
   204		ret = device_property_read_u32(dev, "adi,pga-value", &pga_value);
   205		if (ret && ret != -EINVAL)
   206			return dev_err_probe(dev, ret, "Failed to get pga value.\n");
   207	
   208		if (ret == -EINVAL) {
   209			st->pga_gpios = devm_gpiod_get_array(dev, "pga", GPIOD_OUT_LOW);
   210			if (IS_ERR(st->pga_gpios))
   211				return dev_err_probe(dev, PTR_ERR(st->pga_gpios),
   212						     "Failed to get pga gpios.\n");
   213	
   214			st->scale_avail = scale_buffer;
   215			st->scale_avail_size = ARRAY_SIZE(scale_buffer);
   216		} else {
 > 217			for (i = 0; i < ARRAY_SIZE(gain); i++) {
   218				if (pga_value != gain[i])
   219					continue;
   220				pga_index = i;
   221				break;
   222			}
   223	
   224			st->scale_avail = &scale_buffer[pga_index];
   225			st->scale_avail_size = 1;
   226	
   227			st->pga_gpios = NULL;
   228		}
   229	
   230		st->temp_gpio = devm_gpiod_get(dev, "temp", GPIOD_OUT_LOW);
   231		if (IS_ERR(st->temp_gpio))
   232			return dev_err_probe(dev, PTR_ERR(st->temp_gpio),
   233					     "Failed to get temp gpio.\n");
   234	
   235		st->chan_gpio = devm_gpiod_get(dev, "chan", GPIOD_OUT_LOW);
   236		if (IS_ERR(st->chan_gpio))
   237			return dev_err_probe(dev, PTR_ERR(st->chan_gpio),
   238					     "Failed to get chan gpio.\n");
   239	
   240		return 0;
   241	}
   242	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ