Hi Dumitru, kernel test robot noticed the following build warnings: [auto build test WARNING on jic23-iio/togreg] [also build test WARNING on linus/master v6.7-rc4 next-20231206] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Dumitru-Ceclan/iio-adc-ad7173-add-AD7173-driver/20231205-214833 base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg patch link: https://lore.kernel.org/r/20231205134223.17335-2-mitrutzceclan%40gmail.com patch subject: [PATCH v7 2/2] iio: adc: ad7173: add AD7173 driver config: m68k-randconfig-r071-20231207 (https://download.01.org/0day-ci/archive/20231207/202312070921.XWcr7wUd-lkp@xxxxxxxxx/config) compiler: m68k-linux-gcc (GCC) 13.2.0 reproduce: (https://download.01.org/0day-ci/archive/20231207/202312070921.XWcr7wUd-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/202312070921.XWcr7wUd-lkp@xxxxxxxxx/ smatch warnings: drivers/iio/adc/ad7173.c:833 ad7173_fw_parse_channel_config() warn: unsigned 'ref_sel' is never less than zero. vim +/ref_sel +833 drivers/iio/adc/ad7173.c 735 736 static int ad7173_fw_parse_channel_config(struct iio_dev *indio_dev) 737 { 738 struct ad7173_channel *channels_st_priv_arr, *chan_st_priv; 739 struct ad7173_state *st = iio_priv(indio_dev); 740 struct device *dev = indio_dev->dev.parent; 741 struct iio_chan_spec *chan_arr, *chan; 742 struct fwnode_handle *child; 743 unsigned int ain[2], chan_index = 0; 744 unsigned int num_channels; 745 const char *ref_label; 746 u32 ref_sel; 747 int ret; 748 749 st->regulators[0].supply = ad7173_ref_sel_str[AD7173_SETUP_REF_SEL_EXT_REF]; 750 st->regulators[1].supply = ad7173_ref_sel_str[AD7173_SETUP_REF_SEL_EXT_REF2]; 751 st->regulators[2].supply = ad7173_ref_sel_str[AD7173_SETUP_REF_SEL_AVDD1_AVSS]; 752 753 /* If a regulator is not available, it will be set to a dummy regulator. 754 * Each channel reference is checked with regulator_get_voltage() before 755 * setting attributes so if any channel uses a dummy supply the driver 756 * probe will fail. 757 */ 758 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(st->regulators), 759 st->regulators); 760 if (ret) 761 return dev_err_probe(dev, ret, "Failed to get regulators\n"); 762 763 ret = regulator_bulk_enable(ARRAY_SIZE(st->regulators), st->regulators); 764 if (ret) 765 return dev_err_probe(dev, ret, "Failed to enable regulators\n"); 766 767 ret = devm_add_action_or_reset(dev, ad7173_disable_regulators, st); 768 if (ret) 769 return dev_err_probe(dev, ret, 770 "Failed to add regulators disable action\n"); 771 772 num_channels = device_get_child_node_count(dev); 773 774 if (st->info->has_temp) 775 num_channels++; 776 777 if (num_channels == 0) 778 return dev_err_probe(dev, -EINVAL, "No channels specified\n"); 779 st->num_channels = num_channels; 780 781 chan_arr = devm_kcalloc(dev, sizeof(*chan_arr), num_channels, GFP_KERNEL); 782 if (!chan_arr) 783 return -ENOMEM; 784 785 channels_st_priv_arr = devm_kcalloc(dev, num_channels, 786 sizeof(*channels_st_priv_arr), 787 GFP_KERNEL); 788 if (!channels_st_priv_arr) 789 return -ENOMEM; 790 791 indio_dev->channels = chan_arr; 792 indio_dev->num_channels = num_channels; 793 st->channels = channels_st_priv_arr; 794 795 if (st->info->has_temp) { 796 chan_arr[chan_index] = ad7173_temp_iio_channel_template; 797 chan_st_priv = &channels_st_priv_arr[chan_index]; 798 chan_st_priv->ain = 799 AD7173_CH_ADDRESS(chan_arr[chan_index].channel, chan_arr[chan_index].channel2); 800 chan_st_priv->cfg.bipolar = false; 801 chan_st_priv->cfg.input_buf = true; 802 chan_st_priv->cfg.ref_sel = AD7173_SETUP_REF_SEL_INT_REF; 803 st->adc_mode |= AD7173_ADC_MODE_REF_EN; 804 805 chan_index++; 806 } 807 808 device_for_each_child_node(dev, child) { 809 chan = &chan_arr[chan_index]; 810 chan_st_priv = &channels_st_priv_arr[chan_index]; 811 ret = fwnode_property_read_u32_array(child, "diff-channels", 812 ain, ARRAY_SIZE(ain)); 813 if (ret) { 814 fwnode_handle_put(child); 815 return ret; 816 } 817 818 if (ain[0] >= st->info->num_inputs || 819 ain[1] >= st->info->num_inputs) { 820 fwnode_handle_put(child); 821 return dev_err_probe(dev, -EINVAL, 822 "Input pin number out of range for pair (%d %d).\n", 823 ain[0], ain[1]); 824 } 825 826 ref_sel = AD7173_SETUP_REF_SEL_INT_REF; 827 ref_label = ad7173_ref_sel_str[AD7173_SETUP_REF_SEL_INT_REF]; 828 829 fwnode_property_read_string(child, "adi,reference-select", 830 &ref_label); 831 ref_sel = match_string(ad7173_ref_sel_str, 832 ARRAY_SIZE(ad7173_ref_sel_str), ref_label); > 833 if (ref_sel < 0) { 834 fwnode_handle_put(child); 835 return dev_err_probe(dev, -EINVAL, 836 "Invalid channel reference name %s\n", 837 ref_label); 838 } 839 840 if (ref_sel == AD7173_SETUP_REF_SEL_EXT_REF2 && 841 st->info->id != AD7173_ID) { 842 fwnode_handle_put(child); 843 return dev_err_probe(dev, -EINVAL, "External reference 2 is only available on ad7173-8\n"); 844 } 845 846 ret = ad7173_get_ref_voltage_milli(st, ref_sel); 847 if (ret < 0) { 848 fwnode_handle_put(child); 849 return dev_err_probe(dev, ret, 850 "Cannot use reference %u\n", ref_sel); 851 } 852 if (ref_sel == AD7173_SETUP_REF_SEL_INT_REF) 853 st->adc_mode |= AD7173_ADC_MODE_REF_EN; 854 chan_st_priv->cfg.ref_sel = ref_sel; 855 856 *chan = ad7173_channel_template; 857 chan->address = chan_index; 858 chan->scan_index = chan_index; 859 chan->channel = ain[0]; 860 chan->channel2 = ain[1]; 861 chan->differential = true; 862 863 chan_st_priv->ain = AD7173_CH_ADDRESS(ain[0], ain[1]); 864 chan_st_priv->chan_reg = chan_index; 865 chan_st_priv->cfg.input_buf = true; 866 chan_st_priv->cfg.odr = 0; 867 868 chan_st_priv->cfg.bipolar = fwnode_property_read_bool(child, "bipolar"); 869 if (chan_st_priv->cfg.bipolar) 870 chan->info_mask_separate |= BIT(IIO_CHAN_INFO_OFFSET); 871 872 chan_index++; 873 } 874 875 return 0; 876 } 877 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki