Re: [PATCH 4/6] iio: adc: ad7380: add missing supplies

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

 



Hi Julien,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 8bea3878a1511bceadc2fbf284b00bcc5a2ef28d]

url:    https://github.com/intel-lab-lkp/linux/commits/Julien-Stephan/dt-bindings-iio-adc-ad7380-remove-voltage-reference-for-supplies/20241007-234838
base:   8bea3878a1511bceadc2fbf284b00bcc5a2ef28d
patch link:    https://lore.kernel.org/r/20241007-ad7380-fix-supplies-v1-4-badcf813c9b9%40baylibre.com
patch subject: [PATCH 4/6] iio: adc: ad7380: add missing supplies
config: x86_64-buildonly-randconfig-003-20241008 (https://download.01.org/0day-ci/archive/20241008/202410081608.ZxEPPZ0u-lkp@xxxxxxxxx/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241008/202410081608.ZxEPPZ0u-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/202410081608.ZxEPPZ0u-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/iio/adc/ad7380.c:1045:6: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
    1045 |         if (ret)
         |             ^~~
   drivers/iio/adc/ad7380.c:1030:9: note: initialize the variable 'ret' to silence this warning
    1030 |         int ret, i;
         |                ^
         |                 = 0
   1 warning generated.


vim +/ret +1045 drivers/iio/adc/ad7380.c

  1024	
  1025	static int ad7380_probe(struct spi_device *spi)
  1026	{
  1027		struct iio_dev *indio_dev;
  1028		struct ad7380_state *st;
  1029		bool external_ref_en;
  1030		int ret, i;
  1031	
  1032		indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
  1033		if (!indio_dev)
  1034			return -ENOMEM;
  1035	
  1036		st = iio_priv(indio_dev);
  1037		st->spi = spi;
  1038		st->chip_info = spi_get_device_match_data(spi);
  1039		if (!st->chip_info)
  1040			return dev_err_probe(&spi->dev, -EINVAL, "missing match data\n");
  1041	
  1042		devm_regulator_bulk_get_enable(&spi->dev, st->chip_info->num_supplies,
  1043					       st->chip_info->supplies);
  1044	
> 1045		if (ret)
  1046			return dev_err_probe(&spi->dev, ret,
  1047					     "Failed to enable power supplies\n");
  1048		msleep(T_POWERUP_MS);
  1049	
  1050		/*
  1051		 * If there is no REFIO supply, then it means that we are using
  1052		 * the internal 2.5V reference, otherwise REFIO is reference voltage.
  1053		 */
  1054		ret = devm_regulator_get_enable_read_voltage(&spi->dev, "refio");
  1055		if (ret < 0 && ret != -ENODEV)
  1056			return dev_err_probe(&spi->dev, ret,
  1057					     "Failed to get refio regulator\n");
  1058	
  1059		external_ref_en = ret != -ENODEV;
  1060		st->vref_mv = external_ref_en ? ret / 1000 : AD7380_INTERNAL_REF_MV;
  1061	
  1062		if (st->chip_info->num_vcm_supplies > ARRAY_SIZE(st->vcm_mv))
  1063			return dev_err_probe(&spi->dev, -EINVAL,
  1064					     "invalid number of VCM supplies\n");
  1065	
  1066		/*
  1067		 * pseudo-differential chips have common mode supplies for the negative
  1068		 * input pin.
  1069		 */
  1070		for (i = 0; i < st->chip_info->num_vcm_supplies; i++) {
  1071			const char *vcm = st->chip_info->vcm_supplies[i];
  1072	
  1073			ret = devm_regulator_get_enable_read_voltage(&spi->dev, vcm);
  1074			if (ret < 0)
  1075				return dev_err_probe(&spi->dev, ret,
  1076						     "Failed to get %s regulator\n",
  1077						     vcm);
  1078	
  1079			st->vcm_mv[i] = ret / 1000;
  1080		}
  1081	
  1082		st->regmap = devm_regmap_init(&spi->dev, NULL, st, &ad7380_regmap_config);
  1083		if (IS_ERR(st->regmap))
  1084			return dev_err_probe(&spi->dev, PTR_ERR(st->regmap),
  1085					     "failed to allocate register map\n");
  1086	
  1087		/*
  1088		 * Setting up xfer structures for both normal and sequence mode. These
  1089		 * struct are used for both direct read and triggered buffer. Additional
  1090		 * fields will be set up in ad7380_update_xfers() based on the current
  1091		 * state of the driver at the time of the read.
  1092		 */
  1093	
  1094		/*
  1095		 * In normal mode a read is composed of two steps:
  1096		 *   - first, toggle CS (no data xfer) to trigger a conversion
  1097		 *   - then, read data
  1098		 */
  1099		st->normal_xfer[0].cs_change = 1;
  1100		st->normal_xfer[0].cs_change_delay.value = st->chip_info->timing_specs->t_csh_ns;
  1101		st->normal_xfer[0].cs_change_delay.unit = SPI_DELAY_UNIT_NSECS;
  1102		st->normal_xfer[1].rx_buf = st->scan_data;
  1103	
  1104		spi_message_init_with_transfers(&st->normal_msg, st->normal_xfer,
  1105						ARRAY_SIZE(st->normal_xfer));
  1106		/*
  1107		 * In sequencer mode a read is composed of four steps:
  1108		 *   - CS toggle (no data xfer) to get the right point in the sequence
  1109		 *   - CS toggle (no data xfer) to trigger a conversion of AinX0 and
  1110		 *   acquisition of AinX1
  1111		 *   - 2 data reads, to read AinX0 and AinX1
  1112		 */
  1113		st->seq_xfer[0].cs_change = 1;
  1114		st->seq_xfer[0].cs_change_delay.value = st->chip_info->timing_specs->t_csh_ns;
  1115		st->seq_xfer[0].cs_change_delay.unit = SPI_DELAY_UNIT_NSECS;
  1116		st->seq_xfer[1].cs_change = 1;
  1117		st->seq_xfer[1].cs_change_delay.value = st->chip_info->timing_specs->t_csh_ns;
  1118		st->seq_xfer[1].cs_change_delay.unit = SPI_DELAY_UNIT_NSECS;
  1119	
  1120		st->seq_xfer[2].rx_buf = st->scan_data;
  1121		st->seq_xfer[2].cs_change = 1;
  1122		st->seq_xfer[2].cs_change_delay.value = st->chip_info->timing_specs->t_csh_ns;
  1123		st->seq_xfer[2].cs_change_delay.unit = SPI_DELAY_UNIT_NSECS;
  1124	
  1125		spi_message_init_with_transfers(&st->seq_msg, st->seq_xfer,
  1126						ARRAY_SIZE(st->seq_xfer));
  1127	
  1128		indio_dev->channels = st->chip_info->channels;
  1129		indio_dev->num_channels = st->chip_info->num_channels;
  1130		indio_dev->name = st->chip_info->name;
  1131		indio_dev->info = &ad7380_info;
  1132		indio_dev->modes = INDIO_DIRECT_MODE;
  1133		indio_dev->available_scan_masks = st->chip_info->available_scan_masks;
  1134	
  1135		ret = devm_iio_triggered_buffer_setup(&spi->dev, indio_dev,
  1136						      iio_pollfunc_store_time,
  1137						      ad7380_trigger_handler,
  1138						      &ad7380_buffer_setup_ops);
  1139		if (ret)
  1140			return ret;
  1141	
  1142		ret = ad7380_init(st, external_ref_en);
  1143		if (ret)
  1144			return ret;
  1145	
  1146		return devm_iio_device_register(&spi->dev, indio_dev);
  1147	}
  1148	

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




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux