[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202208010745.QZRYCihu-lkp@intel.com>
Date: Mon, 1 Aug 2022 07:30:35 +0800
From: kernel test robot <lkp@...el.com>
To: Claudiu Beznea <claudiu.beznea@...rochip.com>
Cc: llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org,
Jonathan Cameron <Jonathan.Cameron@...wei.com>
Subject: [jic23-iio:testing 21/30] drivers/iio/adc/at91-sama5d2_adc.c:790:11:
warning: variable 'nbits' is used uninitialized whenever 'if' condition is
false
tree: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git testing
head: e776e5ec0a21cc38f5e853d4dc98845d6e7f76b0
commit: 1c890d33c115b6331d8df8c06e46d3fc4e4e9d42 [21/30] iio: adc: at91-sama5d2_adc: adjust osr based on specific platform data
config: arm-randconfig-r026-20220731 (https://download.01.org/0day-ci/archive/20220801/202208010745.QZRYCihu-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 52cd00cabf479aa7eb6dbb063b7ba41ea57bce9e)
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 arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?id=1c890d33c115b6331d8df8c06e46d3fc4e4e9d42
git remote add jic23-iio https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
git fetch --no-tags jic23-iio testing
git checkout 1c890d33c115b6331d8df8c06e46d3fc4e4e9d42
# 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=arm SHELL=/bin/bash drivers/iio/adc/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
>> drivers/iio/adc/at91-sama5d2_adc.c:790:11: warning: variable 'nbits' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
else if (st->oversampling_ratio == 16)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/adc/at91-sama5d2_adc.c:797:48: note: uninitialized use occurs here
diff = st->soc_info.platform->chan_realbits - nbits;
^~~~~
drivers/iio/adc/at91-sama5d2_adc.c:790:7: note: remove the 'if' if its condition is always true
else if (st->oversampling_ratio == 16)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/adc/at91-sama5d2_adc.c:784:11: note: initialize the variable 'nbits' to silence this warning
int nbits, diff;
^
= 0
1 warning generated.
vim +790 drivers/iio/adc/at91-sama5d2_adc.c
781
782 static int at91_adc_adjust_val_osr(struct at91_adc_state *st, int *val)
783 {
784 int nbits, diff;
785
786 if (st->oversampling_ratio == 1)
787 nbits = 12;
788 else if (st->oversampling_ratio == 4)
789 nbits = 13;
> 790 else if (st->oversampling_ratio == 16)
791 nbits = 14;
792
793 /*
794 * We have nbits of real data and channel is registered as
795 * st->soc_info.platform->chan_realbits, so shift left diff bits.
796 */
797 diff = st->soc_info.platform->chan_realbits - nbits;
798 *val <<= diff;
799
800 return IIO_VAL_INT;
801 }
802
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Powered by blists - more mailing lists