On 25/10/2024 11:01, kernel test robot wrote: > Hi Javier, > > kernel test robot noticed the following build warnings: > > [auto build test WARNING on ceab669fdf7b7510b4e4997b33d6f66e433a96db] > > url: https://github.com/intel-lab-lkp/linux/commits/Javier-Carrasco/dt-bindings-iio-light-veml6030-add-veml3235/20241024-030144 > base: ceab669fdf7b7510b4e4997b33d6f66e433a96db > patch link: https://lore.kernel.org/r/20241023-veml3235-v3-2-8490f2622f9a%40gmail.com > patch subject: [PATCH v3 2/2] iio: light: add support for veml3235 > config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20241025/202410251610.kB7u6xMJ-lkp@xxxxxxxxx/config) > compiler: loongarch64-linux-gcc (GCC) 14.1.0 > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241025/202410251610.kB7u6xMJ-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/202410251610.kB7u6xMJ-lkp@xxxxxxxxx/ > > All warnings (new ones prefixed by >>): > > drivers/iio/light/veml3235.c: In function 'veml3235_set_it': >>> drivers/iio/light/veml3235.c:148:26: warning: variable 'it_idx' set but not used [-Wunused-but-set-variable] > 148 | int ret, new_it, it_idx; > | ^~~~~~ > drivers/iio/light/veml3235.c: In function 'veml3235_set_gain': >>> drivers/iio/light/veml3235.c:191:28: warning: variable 'gain_idx' set but not used [-Wunused-but-set-variable] > 191 | int ret, new_gain, gain_idx; > | ^~~~~~~~ > > > vim +/it_idx +148 drivers/iio/light/veml3235.c > > 144 > 145 static int veml3235_set_it(struct iio_dev *indio_dev, int val, int val2) > 146 { > 147 struct veml3235_data *data = iio_priv(indio_dev); > > 148 int ret, new_it, it_idx; > 149 > 150 if (val) > 151 return -EINVAL; > 152 > 153 switch (val2) { > 154 case 50000: > 155 new_it = 0x00; > 156 it_idx = 4; > 157 break; > 158 case 100000: > 159 new_it = 0x01; > 160 it_idx = 3; > 161 break; > 162 case 200000: > 163 new_it = 0x02; > 164 it_idx = 2; > 165 break; > 166 case 400000: > 167 new_it = 0x03; > 168 it_idx = 1; > 169 break; > 170 case 800000: > 171 new_it = 0x04; > 172 it_idx = 0; > 173 break; > 174 default: > 175 return -EINVAL; > 176 } > 177 > 178 ret = regmap_field_write(data->rf.it, new_it); > 179 if (ret) { > 180 dev_err(data->dev, > 181 "failed to update integration time: %d\n", ret); > 182 return ret; > 183 } > 184 > 185 return 0; > 186 } > 187 > 188 static int veml3235_set_gain(struct iio_dev *indio_dev, int val, int val2) > 189 { > 190 struct veml3235_data *data = iio_priv(indio_dev); > > 191 int ret, new_gain, gain_idx; > 192 > 193 if (val2 != 0) > 194 return -EINVAL; > 195 > 196 switch (val) { > 197 case 1: > 198 new_gain = 0x00; > 199 gain_idx = 3; > 200 break; > 201 case 2: > 202 new_gain = 0x01; > 203 gain_idx = 2; > 204 break; > 205 case 4: > 206 new_gain = 0x03; > 207 gain_idx = 1; > 208 break; > 209 case 8: > 210 new_gain = 0x07; > 211 gain_idx = 0; > 212 break; > 213 default: > 214 return -EINVAL; > 215 } > 216 > 217 ret = regmap_field_write(data->rf.gain, new_gain); > 218 if (ret) { > 219 dev_err(data->dev, "failed to set gain: %d\n", ret); > 220 return ret; > 221 } > 222 > 223 return 0; > 224 } > 225 > Unused as there is no processed values anymore. I will drop them for v4.