Hi Dmitry, kernel test robot noticed the following build warnings: https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Dmitry-Torokhov/Input-adc-joystick-move-axes-data-into-the-main-structure/20240610-060124 base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next patch link: https://lore.kernel.org/r/ZmYlfKDm5sgB44EU%40google.com patch subject: [PATCH] Input: adc-joystick - move axes data into the main structure config: x86_64-randconfig-161-20240611 (https://download.01.org/0day-ci/archive/20240611/202406111750.AXBfJUS3-lkp@xxxxxxxxx/config) compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1) 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> | Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> | Closes: https://lore.kernel.org/r/202406111750.AXBfJUS3-lkp@xxxxxxxxx/ smatch warnings: drivers/input/joystick/adc-joystick.c:166 adc_joystick_set_axes() error: uninitialized symbol 'axes'. drivers/input/joystick/adc-joystick.c:241 adc_joystick_probe() error: uninitialized symbol 'joy'. drivers/input/joystick/adc-joystick.c:241 adc_joystick_probe() warn: passing zero to 'PTR_ERR' vim +/axes +166 drivers/input/joystick/adc-joystick.c 2c2b364fddd551 Artur Rojek 2020-09-28 131 2c2b364fddd551 Artur Rojek 2020-09-28 132 static int adc_joystick_set_axes(struct device *dev, struct adc_joystick *joy) 2c2b364fddd551 Artur Rojek 2020-09-28 133 { 2c2b364fddd551 Artur Rojek 2020-09-28 134 struct adc_joystick_axis *axes; 2c2b364fddd551 Artur Rojek 2020-09-28 135 struct fwnode_handle *child; 815b74328f141f Dmitry Torokhov 2024-06-09 136 s32 range[2], fuzz, flat; 815b74328f141f Dmitry Torokhov 2024-06-09 137 unsigned int num_axes; 815b74328f141f Dmitry Torokhov 2024-06-09 138 int error, i; 2c2b364fddd551 Artur Rojek 2020-09-28 139 2c2b364fddd551 Artur Rojek 2020-09-28 140 num_axes = device_get_child_node_count(dev); 2c2b364fddd551 Artur Rojek 2020-09-28 141 if (!num_axes) { 2c2b364fddd551 Artur Rojek 2020-09-28 142 dev_err(dev, "Unable to find child nodes\n"); 2c2b364fddd551 Artur Rojek 2020-09-28 143 return -EINVAL; 2c2b364fddd551 Artur Rojek 2020-09-28 144 } 2c2b364fddd551 Artur Rojek 2020-09-28 145 2c2b364fddd551 Artur Rojek 2020-09-28 146 if (num_axes != joy->num_chans) { 2c2b364fddd551 Artur Rojek 2020-09-28 147 dev_err(dev, "Got %d child nodes for %d channels\n", 2c2b364fddd551 Artur Rojek 2020-09-28 148 num_axes, joy->num_chans); 2c2b364fddd551 Artur Rojek 2020-09-28 149 return -EINVAL; 2c2b364fddd551 Artur Rojek 2020-09-28 150 } 2c2b364fddd551 Artur Rojek 2020-09-28 151 2c2b364fddd551 Artur Rojek 2020-09-28 152 device_for_each_child_node(dev, child) { 2c2b364fddd551 Artur Rojek 2020-09-28 153 error = fwnode_property_read_u32(child, "reg", &i); 2c2b364fddd551 Artur Rojek 2020-09-28 154 if (error) { 2c2b364fddd551 Artur Rojek 2020-09-28 155 dev_err(dev, "reg invalid or missing\n"); 2c2b364fddd551 Artur Rojek 2020-09-28 156 goto err_fwnode_put; 2c2b364fddd551 Artur Rojek 2020-09-28 157 } 2c2b364fddd551 Artur Rojek 2020-09-28 158 2c2b364fddd551 Artur Rojek 2020-09-28 159 if (i >= num_axes) { 2c2b364fddd551 Artur Rojek 2020-09-28 160 error = -EINVAL; 2c2b364fddd551 Artur Rojek 2020-09-28 161 dev_err(dev, "No matching axis for reg %d\n", i); 2c2b364fddd551 Artur Rojek 2020-09-28 162 goto err_fwnode_put; 2c2b364fddd551 Artur Rojek 2020-09-28 163 } 2c2b364fddd551 Artur Rojek 2020-09-28 164 2c2b364fddd551 Artur Rojek 2020-09-28 165 error = fwnode_property_read_u32(child, "linux,code", 2c2b364fddd551 Artur Rojek 2020-09-28 @166 &axes[i].code); axes is unitialized. 2c2b364fddd551 Artur Rojek 2020-09-28 167 if (error) { 2c2b364fddd551 Artur Rojek 2020-09-28 168 dev_err(dev, "linux,code invalid or missing\n"); 2c2b364fddd551 Artur Rojek 2020-09-28 169 goto err_fwnode_put; 2c2b364fddd551 Artur Rojek 2020-09-28 170 } 2c2b364fddd551 Artur Rojek 2020-09-28 171 2c2b364fddd551 Artur Rojek 2020-09-28 172 error = fwnode_property_read_u32_array(child, "abs-range", 815b74328f141f Dmitry Torokhov 2024-06-09 173 range, 2); 2c2b364fddd551 Artur Rojek 2020-09-28 174 if (error) { 2c2b364fddd551 Artur Rojek 2020-09-28 175 dev_err(dev, "abs-range invalid or missing\n"); 2c2b364fddd551 Artur Rojek 2020-09-28 176 goto err_fwnode_put; 2c2b364fddd551 Artur Rojek 2020-09-28 177 } 2c2b364fddd551 Artur Rojek 2020-09-28 178 815b74328f141f Dmitry Torokhov 2024-06-09 179 if (range[0] > range[1]) { 6560cfcfb46511 Chris Morgan 2024-01-19 180 dev_dbg(dev, "abs-axis %d inverted\n", i); 6560cfcfb46511 Chris Morgan 2024-01-19 181 axes[i].inverted = true; 815b74328f141f Dmitry Torokhov 2024-06-09 182 swap(range[0], range[1]); 6560cfcfb46511 Chris Morgan 2024-01-19 183 } 6560cfcfb46511 Chris Morgan 2024-01-19 184 815b74328f141f Dmitry Torokhov 2024-06-09 185 fwnode_property_read_u32(child, "abs-fuzz", &fuzz); 815b74328f141f Dmitry Torokhov 2024-06-09 186 fwnode_property_read_u32(child, "abs-flat", &flat); 2c2b364fddd551 Artur Rojek 2020-09-28 187 2c2b364fddd551 Artur Rojek 2020-09-28 188 input_set_abs_params(joy->input, axes[i].code, 815b74328f141f Dmitry Torokhov 2024-06-09 189 range[0], range[1], fuzz, flat); 2c2b364fddd551 Artur Rojek 2020-09-28 190 } 2c2b364fddd551 Artur Rojek 2020-09-28 191 2c2b364fddd551 Artur Rojek 2020-09-28 192 return 0; 2c2b364fddd551 Artur Rojek 2020-09-28 193 2c2b364fddd551 Artur Rojek 2020-09-28 194 err_fwnode_put: 2c2b364fddd551 Artur Rojek 2020-09-28 195 fwnode_handle_put(child); 2c2b364fddd551 Artur Rojek 2020-09-28 196 return error; 2c2b364fddd551 Artur Rojek 2020-09-28 197 } 2c2b364fddd551 Artur Rojek 2020-09-28 198 815b74328f141f Dmitry Torokhov 2024-06-09 199 815b74328f141f Dmitry Torokhov 2024-06-09 200 /* 815b74328f141f Dmitry Torokhov 2024-06-09 201 * Count how many channels we got. NULL terminated. 815b74328f141f Dmitry Torokhov 2024-06-09 202 * Do not check the storage size if using polling. 815b74328f141f Dmitry Torokhov 2024-06-09 203 */ 815b74328f141f Dmitry Torokhov 2024-06-09 204 static int adc_joystick_count_channels(struct device *dev, 815b74328f141f Dmitry Torokhov 2024-06-09 205 const struct iio_channel *chans, 815b74328f141f Dmitry Torokhov 2024-06-09 206 bool polled, 815b74328f141f Dmitry Torokhov 2024-06-09 207 unsigned int *num_chans) 815b74328f141f Dmitry Torokhov 2024-06-09 208 { 815b74328f141f Dmitry Torokhov 2024-06-09 209 int bits; 815b74328f141f Dmitry Torokhov 2024-06-09 210 int i; 815b74328f141f Dmitry Torokhov 2024-06-09 211 815b74328f141f Dmitry Torokhov 2024-06-09 212 for (i = 0; chans[i].indio_dev; i++) { 815b74328f141f Dmitry Torokhov 2024-06-09 213 if (polled) 815b74328f141f Dmitry Torokhov 2024-06-09 214 continue; 815b74328f141f Dmitry Torokhov 2024-06-09 215 bits = chans[i].channel->scan_type.storagebits; 815b74328f141f Dmitry Torokhov 2024-06-09 216 if (!bits || bits > 16) { 815b74328f141f Dmitry Torokhov 2024-06-09 217 dev_err(dev, "Unsupported channel storage size\n"); 815b74328f141f Dmitry Torokhov 2024-06-09 218 return -EINVAL; 815b74328f141f Dmitry Torokhov 2024-06-09 219 } 815b74328f141f Dmitry Torokhov 2024-06-09 220 if (bits != chans[0].channel->scan_type.storagebits) { 815b74328f141f Dmitry Torokhov 2024-06-09 221 dev_err(dev, "Channels must have equal storage size\n"); 815b74328f141f Dmitry Torokhov 2024-06-09 222 return -EINVAL; 815b74328f141f Dmitry Torokhov 2024-06-09 223 } 815b74328f141f Dmitry Torokhov 2024-06-09 224 } 815b74328f141f Dmitry Torokhov 2024-06-09 225 815b74328f141f Dmitry Torokhov 2024-06-09 226 return i; 815b74328f141f Dmitry Torokhov 2024-06-09 227 } 815b74328f141f Dmitry Torokhov 2024-06-09 228 2c2b364fddd551 Artur Rojek 2020-09-28 229 static int adc_joystick_probe(struct platform_device *pdev) 2c2b364fddd551 Artur Rojek 2020-09-28 230 { 2c2b364fddd551 Artur Rojek 2020-09-28 231 struct device *dev = &pdev->dev; 815b74328f141f Dmitry Torokhov 2024-06-09 232 struct iio_channel *chans; 2c2b364fddd551 Artur Rojek 2020-09-28 233 struct adc_joystick *joy; 2c2b364fddd551 Artur Rojek 2020-09-28 234 struct input_dev *input; 815b74328f141f Dmitry Torokhov 2024-06-09 235 unsigned int poll_interval = 0; 815b74328f141f Dmitry Torokhov 2024-06-09 236 unsigned int num_chans; 2c2b364fddd551 Artur Rojek 2020-09-28 237 int error; 2c2b364fddd551 Artur Rojek 2020-09-28 238 815b74328f141f Dmitry Torokhov 2024-06-09 239 chans = devm_iio_channel_get_all(dev); 815b74328f141f Dmitry Torokhov 2024-06-09 240 if (IS_ERR(chans)) { 2c2b364fddd551 Artur Rojek 2020-09-28 @241 error = PTR_ERR(joy->chans); s/joy->chans/chans/ 2c2b364fddd551 Artur Rojek 2020-09-28 242 if (error != -EPROBE_DEFER) 2c2b364fddd551 Artur Rojek 2020-09-28 243 dev_err(dev, "Unable to get IIO channels"); 2c2b364fddd551 Artur Rojek 2020-09-28 244 return error; 2c2b364fddd551 Artur Rojek 2020-09-28 245 } 2c2b364fddd551 Artur Rojek 2020-09-28 246 24c06e000e8fa2 Chris Morgan 2022-08-16 247 error = device_property_read_u32(dev, "poll-interval", &poll_interval); -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki