Hi, kernel test robot noticed the following build warnings: [auto build test WARNING on jic23-iio/togreg] [also build test WARNING on linus/master v6.10 next-20240719] [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/marius-cristea-microchip-com/dt-bindings-iio-adc-adding-support-for-PAC194X/20240720-014249 base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg patch link: https://lore.kernel.org/r/20240719173855.53261-3-marius.cristea%40microchip.com patch subject: [PATCH v1 2/2] iio: adc: adding support for PAC194X config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20240721/202407210028.rJXFbiBg-lkp@xxxxxxxxx/config) compiler: sh4-linux-gcc (GCC) 14.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240721/202407210028.rJXFbiBg-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/202407210028.rJXFbiBg-lkp@xxxxxxxxx/ All warnings (new ones prefixed by >>): drivers/iio/adc/pac1944.c: In function 'pac1944_prep_custom_attributes': >> drivers/iio/adc/pac1944.c:2048:23: warning: variable 'idx' set but not used [-Wunused-but-set-variable] 2048 | int ch, i, j, idx; | ^~~ vim +/idx +2048 drivers/iio/adc/pac1944.c 2044 2045 static int pac1944_prep_custom_attributes(struct pac1944_chip_info *info, 2046 struct iio_dev *indio_dev) 2047 { > 2048 int ch, i, j, idx; 2049 int active_channels_count = 0; 2050 struct attribute **pac1944_custom_attrs, **tmp_attr; 2051 struct attribute_group *pac1944_group; 2052 int custom_attr_cnt; 2053 struct i2c_client *client = info->client; 2054 2055 for (i = 0 ; i < info->phys_channels; i++) 2056 if (info->active_channels[i]) 2057 active_channels_count++; 2058 2059 pac1944_group = devm_kzalloc(&client->dev, sizeof(*pac1944_group), GFP_KERNEL); 2060 if (!pac1944_group) 2061 return -ENOMEM; 2062 2063 /* 2064 * Attributes for channel X: 2065 * - in_shunt_value_X 2066 * - in_oc_limit_nsamples 2067 * - in_uc_limit_nsamples 2068 * - in_op_limit_nsamples 2069 * - in_ov_limit_nsamples 2070 * - in_uv_limit_nsamples 2071 * - one of pair attributes: 2072 * - in_power_accX_raw and in_power_accX_scale 2073 * - in_current_accX_raw and in_current_accX_scale 2074 * - in_voltage_accX_raw and in_voltage_accX_scale 2075 * Shared attributes: 2076 * - in_acc_fullness 2077 * - in_alert_enable 2078 * - in_slow_alert1 2079 * - gpio_alert2 2080 * - out_alert_status 2081 * NULL 2082 */ 2083 custom_attr_cnt = PAC1944_COMMON_DEVATTR * active_channels_count; 2084 custom_attr_cnt += PAC1944_ACC_DEVATTR * active_channels_count; 2085 custom_attr_cnt += PAC1944_SHARED_DEVATTRS_COUNT; 2086 2087 pac1944_custom_attrs = devm_kzalloc(&client->dev, custom_attr_cnt * 2088 sizeof(*pac1944_group) + 1, GFP_KERNEL); 2089 if (!pac1944_custom_attrs) 2090 return -ENOMEM; 2091 2092 j = 0; 2093 for (ch = 0 ; ch < info->phys_channels; ch++) { 2094 if (!info->active_channels[ch]) 2095 continue; 2096 2097 for (i = 0; i < PAC1944_COMMON_DEVATTR; i++) 2098 pac1944_custom_attrs[j++] = 2099 pac1944_all_attrs[PAC1944_COMMON_DEVATTR * ch + i]; 2100 2101 idx = ch; 2102 switch (info->chip_reg_data.accumulation_mode[ch]) { 2103 case PAC1944_ACCMODE_VPOWER: 2104 tmp_attr = pac1944_power_acc_attr; 2105 break; 2106 case PAC1944_ACCMODE_VSENSE: 2107 tmp_attr = pac1944_current_acc_attr; 2108 break; 2109 case PAC1944_ACCMODE_VBUS: 2110 tmp_attr = pac1944_voltage_acc_attr; 2111 break; 2112 default: 2113 return -EINVAL; 2114 } 2115 2116 pac1944_custom_attrs[j++] = tmp_attr[ch]; 2117 pac1944_custom_attrs[j++] = pac1944_power_acc_attr[PAC1944_MAX_CH + ch]; 2118 pac1944_custom_attrs[j++] = pac1944_power_acc_attr[2 * PAC1944_MAX_CH + ch]; 2119 } 2120 2121 for (i = 0; i < PAC1944_SHARED_DEVATTRS_COUNT; i++) 2122 pac1944_custom_attrs[j++] = 2123 pac1944_all_attrs[PAC1944_COMMON_DEVATTR * PAC1944_MAX_CH + i]; 2124 2125 pac1944_group->attrs = pac1944_custom_attrs; 2126 info->iio_info.attrs = pac1944_group; 2127 2128 return 0; 2129 } 2130 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki