[linux-next:master 4152/8345] drivers/iio/adc/mcp3564.c:1105 mcp3564_fill_scale_tbls() warn: unsigned '__x' is never less than zero.

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   18030226a48de1fbfabf4ae16aaa2695a484254f
commit: 33ec3e5fc1ea0e0c5c93425170602533c07f55d4 [4152/8345] iio: adc: adding support for MCP3564 ADC
config: x86_64-randconfig-161-20230927 (https://download.01.org/0day-ci/archive/20230928/202309280738.NWjVfVt4-lkp@xxxxxxxxx/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce: (https://download.01.org/0day-ci/archive/20230928/202309280738.NWjVfVt4-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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309280738.NWjVfVt4-lkp@xxxxxxxxx/

smatch warnings:
drivers/iio/adc/mcp3564.c:1105 mcp3564_fill_scale_tbls() warn: unsigned '__x' is never less than zero.
drivers/iio/adc/mcp3564.c:1426 mcp3564_probe() warn: passing zero to 'PTR_ERR'
drivers/iio/adc/mcp3564.c:1426 mcp3564_probe() warn: address of NULL pointer 'indio_dev'

vim +/__x +1105 drivers/iio/adc/mcp3564.c

  1094	
  1095	static void mcp3564_fill_scale_tbls(struct mcp3564_state *adc)
  1096	{
  1097		unsigned int pow = adc->chip_info->resolution - 1;
  1098		int ref;
  1099		unsigned int i;
  1100		int tmp0;
  1101		u64 tmp1;
  1102	
  1103		for (i = 0; i < MCP3564_MAX_PGA; i++) {
  1104			ref = adc->vref_mv;
> 1105			tmp1 = shift_right((u64)ref * NANO, pow);
  1106			div_u64_rem(tmp1, NANO, &tmp0);
  1107	
  1108			tmp1 = tmp1 * mcp3564_hwgain_frac[(2 * i) + 1];
  1109			tmp0 = (int)div_u64(tmp1, mcp3564_hwgain_frac[2 * i]);
  1110	
  1111			adc->scale_tbls[i][1] = tmp0;
  1112		}
  1113	}
  1114	

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux