Re: [PATCH v3 2/2] drivers:iio:dac: Add AD3552R driver support

From: kernel test robot
Date: Sun Oct 24 2021 - 09:22:23 EST


Hi Mihail,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on ef226dcf3d88697a06335fbc55c4263ab164b135]

url: https://github.com/0day-ci/linux/commits/Mihail-Chindris/drivers-iio-dac-Add-AD3552R-driver-support/20211021-151417
base: ef226dcf3d88697a06335fbc55c4263ab164b135
config: nios2-allyesconfig (attached as .config)
compiler: nios2-linux-gcc (GCC) 11.2.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://github.com/0day-ci/linux/commit/6c22b3c7b44166beec8e31f25025042cc0da1ba7
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Mihail-Chindris/drivers-iio-dac-Add-AD3552R-driver-support/20211021-151417
git checkout 6c22b3c7b44166beec8e31f25025042cc0da1ba7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=nios2

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

drivers/iio/dac/ad3552r.c: In function 'ad3552r_configure_device':
>> drivers/iio/dac/ad3552r.c:978:14: error: variable 'is_custom' set but not used [-Werror=unused-but-set-variable]
978 | bool is_custom;
| ^~~~~~~~~
cc1: all warnings being treated as errors


vim +/is_custom +978 drivers/iio/dac/ad3552r.c

970
971 static int ad3552r_configure_device(struct ad3552r_desc *dac)
972 {
973 struct device *dev = &dac->spi->dev;
974 struct fwnode_handle *child;
975 struct regulator *vref;
976 int err, cnt = 0, voltage, delta = 100000;
977 u32 vals[2], val, ch;
> 978 bool is_custom;
979
980 dac->gpio_ldac = devm_gpiod_get_optional(dev, "ldac", GPIOD_OUT_HIGH);
981 if (IS_ERR(dac->gpio_ldac))
982 return dev_err_probe(dev, PTR_ERR(dac->gpio_ldac),
983 "Error getting gpio ldac");
984
985 vref = devm_regulator_get_optional(dev, "vref");
986 if (IS_ERR(vref)) {
987 if (PTR_ERR(vref) != -ENODEV)
988 return dev_err_probe(dev, PTR_ERR(vref),
989 "Error getting vref");
990 vref = NULL;
991 }
992 if (vref) {
993 voltage = regulator_get_voltage(vref);
994 if (voltage > 2500000 + delta || voltage < 2500000 - delta) {
995 dev_warn(dev, "vref-supply must be 2.5V");
996 return -EINVAL;
997 }
998 val = AD3552R_EXTERNAL_VREF_PIN_INPUT;
999 } else {
1000 if (device_property_read_bool(dev, "adi,vref-out-en"))
1001 val = AD3552R_INTERNAL_VREF_PIN_2P5V;
1002 else
1003 val = AD3552R_INTERNAL_VREF_PIN_FLOATING;
1004 }
1005 err = ad3552r_update_reg_field(dac,
1006 addr_mask_map[AD3552R_VREF_SELECT][0],
1007 addr_mask_map[AD3552R_VREF_SELECT][1],
1008 val);
1009 if (err)
1010 return err;
1011
1012 err = device_property_read_u32(dev, "adi,sdo-drive-strength", &val);
1013 if (!err) {
1014 if (val > 3)
1015 return dev_err_probe(dev, -EINVAL,
1016 "adi,sdo-drive-strength must be less than 4\n");
1017
1018 err = ad3552r_update_reg_field(dac,
1019 addr_mask_map[AD3552R_SDO_DRIVE_STRENGTH][0],
1020 addr_mask_map[AD3552R_SDO_DRIVE_STRENGTH][1],
1021 val);
1022 if (err)
1023 return err;
1024 }
1025
1026 dac->num_ch = device_get_child_node_count(dev);
1027 if (!dac->num_ch)
1028 return dev_err_probe(dev, -ENODEV, "No channels defined\n");
1029
1030 device_for_each_child_node(dev, child) {
1031 err = fwnode_property_read_u32(child, "reg", &ch);
1032 if (err) {
1033 dev_err_probe(dev, err,
1034 "mandatory reg property missing\n");
1035 goto put_child;
1036 }
1037 if (ch >= AD3552R_NUM_CH) {
1038 dev_err_probe(dev, err, "reg must be less than %d\n",
1039 AD3552R_NUM_CH);
1040 err = -EINVAL;
1041 goto put_child;
1042 }
1043
1044 if (fwnode_property_present(child, "adi,output-range-microvolt")) {
1045 is_custom = false;
1046 err = fwnode_property_read_u32_array(child,
1047 "adi,output-range-microvolt",
1048 vals,
1049 2);
1050 if (err) {
1051 dev_err_probe(dev, err,
1052 "mandatory adi,output-range-microvolt property missing\n");
1053 goto put_child;
1054 }
1055
1056 val = ad3552r_find_range(dac->chip_id, vals);
1057 if ((s32)val < 0) {
1058 err = -EINVAL;
1059 dev_err_probe(dev, err,
1060 "Invalid adi,output-range-microvolt value\n");
1061 goto put_child;
1062 }
1063 err = ad3552r_set_ch_value(dac,
1064 AD3552R_CH_OUTPUT_RANGE_SEL,
1065 ch, val);
1066 if (err)
1067 goto put_child;
1068
1069 dac->ch_data[ch].range = val;
1070 } else {
1071 is_custom = true;
1072 err = ad3552r_configure_custom_gain(dac, child, ch);
1073 if (err)
1074 goto put_child;
1075 }
1076
1077 ad3552r_calc_gain_and_offset(dac, ch);
1078 dac->enabled_ch |= BIT(ch);
1079
1080 err = ad3552r_set_ch_value(dac, AD3552R_CH_SELECT, ch, 1);
1081 if (err < 0)
1082 return err;
1083
1084 dac->channels[cnt] = AD3552R_CH_DAC(ch);
1085 ++cnt;
1086
1087 }
1088
1089 /* Disable unused channels */
1090 for_each_clear_bit(ch, &dac->enabled_ch, AD3552R_NUM_CH) {
1091 err = ad3552r_set_ch_value(dac, AD3552R_CH_AMPLIFIER_POWERDOWN,
1092 ch, 0);
1093 if (err)
1094 return err;
1095 }
1096
1097 dac->num_ch = cnt;
1098
1099 return 0;
1100 put_child:
1101 fwnode_handle_put(child);
1102
1103 return err;
1104 }
1105

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip