[jic23-iio:testing 58/58] drivers/iio/adc/mcp3911.c:274:13: warning: variable 'tmp0' set but not used

From: kernel test robot
Date: Wed Sep 21 2022 - 18:08:52 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git testing
head: d4e1a549566b9ea8b96e80f0cdcbe99714ac256e
commit: d4e1a549566b9ea8b96e80f0cdcbe99714ac256e [58/58] iio: adc: mcp3911: add support to set PGA
config: loongarch-allyesconfig (https://download.01.org/0day-ci/archive/20220922/202209220648.Wb6EtPat-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 12.1.0
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://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?id=d4e1a549566b9ea8b96e80f0cdcbe99714ac256e
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 d4e1a549566b9ea8b96e80f0cdcbe99714ac256e
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=loongarch SHELL=/bin/bash drivers/iio/

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/iio/adc/mcp3911.c: In function 'mcp3911_calc_scale_table':
>> drivers/iio/adc/mcp3911.c:274:13: warning: variable 'tmp0' set but not used [-Wunused-but-set-variable]
274 | int tmp0, tmp1;
| ^~~~


vim +/tmp0 +274 drivers/iio/adc/mcp3911.c

268
269 static int mcp3911_calc_scale_table(struct mcp3911 *adc)
270 {
271 u32 ref = MCP3911_INT_VREF_MV;
272 u32 div;
273 int ret;
> 274 int tmp0, tmp1;
275 s64 tmp2;
276
277 if (adc->vref) {
278 ret = regulator_get_voltage(adc->vref);
279 if (ret < 0) {
280 dev_err(&adc->spi->dev,
281 "failed to get vref voltage: %d\n",
282 ret);
283 return ret;
284 }
285
286 ref = ret / 1000;
287 }
288
289 /*
290 * For 24-bit Conversion
291 * Raw = ((Voltage)/(Vref) * 2^23 * Gain * 1.5
292 * Voltage = Raw * (Vref)/(2^23 * Gain * 1.5)
293 *
294 * ref = Reference voltage
295 * div = (2^23 * 1.5 * gain) = 12582912 * gain
296 */
297 for (int i = 0; i < MCP3911_NUM_SCALES; i++) {
298 div = 12582912 * BIT(i);
299 tmp2 = div_s64((s64)ref * 1000000000LL, div);
300 tmp1 = div;
301 tmp0 = (int)div_s64_rem(tmp2, 1000000000, &tmp1);
302
303 mcp3911_scale_table[i][0] = 0;
304 mcp3911_scale_table[i][1] = tmp1;
305 }
306
307 return 0;
308 }
309

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