Re: [PATCH 1/2] regulator: ltc7871: Add driver for LTC7871

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

 



Hi Celine,

kernel test robot noticed the following build warnings:

[auto build test WARNING on fff64b15e3d1e9bd9246db1f5e0b84e7e561b79f]

url:    https://github.com/intel-lab-lkp/linux/commits/Celine-Joy-A-Capua/regulator-ltc7871-Add-driver-for-LTC7871/20250210-103432
base:   fff64b15e3d1e9bd9246db1f5e0b84e7e561b79f
patch link:    https://lore.kernel.org/r/20250210-staging-ltc7871-v1-1-c593ad86aab2%40analog.com
patch subject: [PATCH 1/2] regulator: ltc7871: Add driver for LTC7871
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20250211/202502110205.DShIOHH0-lkp@xxxxxxxxx/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250211/202502110205.DShIOHH0-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/202502110205.DShIOHH0-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   In file included from drivers/regulator/ltc7871-regulator.c:11:
   In file included from include/linux/module.h:19:
   In file included from include/linux/elf.h:6:
   In file included from arch/s390/include/asm/elf.h:181:
   In file included from arch/s390/include/asm/mmu_context.h:11:
   In file included from arch/s390/include/asm/pgalloc.h:18:
   In file included from include/linux/mm.h:2224:
   include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     504 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     505 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     511 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     512 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     524 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     525 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/regulator/ltc7871-regulator.c:318:6: warning: variable 'val2' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
     318 |         if (!ret) {
         |             ^~~~
   drivers/regulator/ltc7871-regulator.c:328:63: note: uninitialized use occurs here
     328 |         return ltc7871_reg_write(chip->spi, LTC7871_REG_SSFM, val1 | val2);
         |                                                                      ^~~~
   drivers/regulator/ltc7871-regulator.c:318:2: note: remove the 'if' if its condition is always true
     318 |         if (!ret) {
         |         ^~~~~~~~~
   drivers/regulator/ltc7871-regulator.c:225:16: note: initialize the variable 'val2' to silence this warning
     225 |         int val1, val2;
         |                       ^
         |                        = 0
   4 warnings generated.


vim +318 drivers/regulator/ltc7871-regulator.c

   221	
   222	static int ltc7871_parse_fw(struct ltc7871 *chip)
   223	{
   224		int reg, ret;
   225		int val1, val2;
   226	
   227		/* Setting default values based on datasheet and DC2886A Schematic */
   228		chip->idac_setcur_uA = 0;
   229		chip->freq_spread_percentage = "+-12%";
   230		chip->switching_freq_divider = 512;
   231		chip->enable_chip_ctrl_wp = 0;
   232		chip->ra_ext = 10000;
   233		chip->rb_ext = 107000;
   234		chip->rc_ext = 12700;
   235		chip->rd_ext = 499000;
   236	
   237		ret = device_property_read_u32(&chip->spi->dev, "adi,ra-external-ohms",
   238					 &chip->ra_ext);
   239		if (!ret) {
   240			if (!chip->ra_ext)
   241				return -EINVAL;
   242		}
   243	
   244		ret = device_property_read_u32(&chip->spi->dev, "adi,rb-external-ohms",
   245					 &chip->rb_ext);
   246		if (!ret) {
   247			if (!chip->rb_ext)
   248				return -EINVAL;
   249		}
   250	
   251		ret = device_property_read_u32(&chip->spi->dev, "adi,rc-external-ohms",
   252					 &chip->rc_ext);
   253		if (!ret) {
   254			if (!chip->rc_ext)
   255				return -EINVAL;
   256		}
   257	
   258		ret = device_property_read_u32(&chip->spi->dev, "adi,rd-external-ohms",
   259					 &chip->rd_ext);
   260		if (!ret) {
   261			if (!chip->rd_ext)
   262				return -EINVAL;
   263		}
   264	
   265		ret = ltc7871_reg_read(chip->spi, LTC7871_REG_CONFIG2, &reg);
   266		if (ret < 0)
   267			return ret;
   268	
   269		chip->regulator_mode = FIELD_GET(LTC7871_MASK_CONFIG2_BUCK_BOOST, reg);
   270	
   271		if (chip->regulator_mode) {
   272			chip->r1 = chip->ra_ext;
   273			chip->r2 = chip->rb_ext;
   274		} else {
   275			chip->r1 = chip->rc_ext;
   276			chip->r2 = chip->rd_ext;
   277		}
   278		chip->min_vol = _ltc7871_dac_to_uV(chip, LTC7871_IDAC_MAX);
   279		chip->max_vol = _ltc7871_dac_to_uV(chip, LTC7871_IDAC_MIN);
   280	
   281		ret = ltc7871_reg_read(chip->spi, LTC7871_REG_CHIP_CTRL, &reg);
   282		if (ret < 0)
   283			return ret;
   284	
   285		chip->enable_chip_ctrl_wp = device_property_read_bool(&chip->spi->dev,
   286							"adi,enable-chip-ctrl-wp");
   287		val1 = FIELD_PREP(LTC7871_MASK_CHIP_CTRL_WP, chip->enable_chip_ctrl_wp) | reg;
   288		ret = ltc7871_reg_write(chip->spi, LTC7871_REG_CHIP_CTRL, val1);
   289		if (ret)
   290			return ret;
   291	
   292		ret = device_property_read_u32(&chip->spi->dev, "adi,idac-setcur-microamp",
   293					 &chip->idac_setcur_uA);
   294		if (!ret) {
   295			if (chip->idac_setcur_uA < LTC7871_IDAC_MIN ||
   296			    chip->idac_setcur_uA > LTC7871_IDAC_MAX) {
   297				return -EINVAL;
   298			}
   299	
   300			ret = ltc7871_reg_write(chip->spi, LTC7871_REG_SETCUR,
   301						chip->idac_setcur_uA);
   302			if (ret)
   303				return ret;
   304		}
   305		ret = device_property_match_property_string(&chip->spi->dev,
   306				"adi,freq-spread-percentage",
   307				ltc7871_freq_spread_percentage,
   308				ARRAY_SIZE(ltc7871_freq_spread_percentage));
   309	
   310		if (ret >= 0)
   311			val1 = FIELD_PREP(LTC7871_MASK_SSFM_FREQ_SPREAD, ret);
   312		else
   313			val1 = 0;
   314	
   315		ret = device_property_read_u32(&chip->spi->dev,
   316					       "adi,switching-freq-divider",
   317					       &chip->switching_freq_divider);
 > 318		if (!ret) {
   319			ret = ltc7871_get_prop_index(ltc7871_switching_freq_divider,
   320						     ARRAY_SIZE(ltc7871_switching_freq_divider),
   321						     chip->switching_freq_divider);
   322			if (ret < 0)
   323				return ret;
   324	
   325			val2 = FIELD_PREP(LTC7871_MASK_SSFM_MOD_SIG_FREQ, ret);
   326		}
   327	
   328		return ltc7871_reg_write(chip->spi, LTC7871_REG_SSFM, val1 | val2);
   329	}
   330	

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




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux