Re: [PATCH v2 7/7] iio: adc: ad4170: Add support for weigh scale and RTD sensors

kernel test robot
2025-05-01T19:50:28Z

Hi Marcelo,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 1c2409fe38d5c19015d69851d15ba543d1911932]

url: https://github.com/intel-lab-lkp/linux/commits/Marcelo-Schmitt/dt-bindings-iio-adc-Add-AD4170/20250428-222010
base: 1c2409fe38d5c19015d69851d15ba543d1911932
patch link: https://lore.kernel.org/r/3687a9e0a479aef9736ad557b341ed2e7d4f5756.1745841276.git.marcelo.schmitt%40analog.com
patch subject: [PATCH v2 7/7] iio: adc: ad4170: Add support for weigh scale and RTD sensors
config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20250502/202505020345.iJUIBTwt-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250502/202505020345.iJUIBTwt-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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505020345.iJUIBTwt-lkp@intel.com/

All warnings (new ones prefixed by >>):

drivers/iio/adc/ad4170.c: In function 'ad4170_setup_current_src.isra':
>> drivers/iio/adc/ad4170.c:1881:29: warning: 'current_src' is used uninitialized [-Wuninitialized]
1881 | current_src |= FIELD_PREP(AD4170_CURRENT_SRC_I_OUT_PIN_MSK, pin);
| ^~
drivers/iio/adc/ad4170.c:1875:22: note: 'current_src' was declared here
1875 | unsigned int current_src, i, j;
| ^~~~~~~~~~~

vim +/current_src +1881 drivers/iio/adc/ad4170.c

1869
1870 static int ad4170_setup_current_src(struct ad4170_state *st,
1871 struct fwnode_handle *child,
1872 struct ad4170_setup *setup, u32 *exc_pins,
1873 int num_exc_pins, int exc_cur, bool ac_excited)
1874 {
1875 unsigned int current_src, i, j;
1876 int ret;
1877
1878 for (i = 0; i < num_exc_pins; i++) {
1879 unsigned int pin = exc_pins[i];
1880
> 1881 current_src |= FIELD_PREP(AD4170_CURRENT_SRC_I_OUT_PIN_MSK, pin);
1882 current_src |= FIELD_PREP(AD4170_CURRENT_SRC_I_OUT_VAL_MSK, exc_cur);
1883
1884 for (j = 0; j < AD4170_NUM_CURRENT_SRC; j++) {
1885 /*
1886 * Excitation current chopping is configured in pairs.
1887 * If current chopping configured and the first end of
1888 * the current source pair has already been assigned,
1889 * skip to the next pair of output currents.
1890 */
1891 if (ac_excited && j % 2 != 0)
1892 continue;
1893
1894 if (st->cur_src_pins[j] == AD4170_CURRENT_SRC_DISABLED) {
1895 st->cur_src_pins[j] = pin;
1896 break;
1897 }
1898 }
1899 if (j == AD4170_NUM_CURRENT_SRC)
1900 return dev_err_probe(&st->spi->dev, -EINVAL,
1901 "Failed to setup IOUT at pin %u\n",
1902 pin);
1903
1904 ret = regmap_write(st->regmap, AD4170_CURRENT_SRC_REG(j),
1905 current_src);
1906 if (ret)
1907 return ret;
1908 }
1909
1910 if (ac_excited && num_exc_pins > 1) {
1911 unsigned int exc_cur_pair;
1912
1913 if (st->cur_src_pins[0] == exc_pins[0])
1914 exc_cur_pair = 1;
1915 else
1916 exc_cur_pair = 2;
1917
1918 /*
1919 * Configure excitation currents chopping.
1920 * Chop two pairs if using four excitation currents.
1921 */
1922 setup->misc |= FIELD_PREP(AD4170_MISC_CHOP_IEXC_MSK,
1923 num_exc_pins == 2 ? exc_cur_pair : 3);
1924 }
1925
1926 return 0;
1927 }
1928

--
0-DAY CI Kernel Test Service