Hi Manuel, kernel test robot noticed the following build warnings: [auto build test WARNING on usb/usb-testing] [also build test WARNING on usb/usb-next usb/usb-linus linus/master v6.12-rc1 next-20241004] [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/Manuel-Quintero-F/USB-atm-speedtch-do-not-use-assignment-in-if-condition/20241004-113643 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing patch link: https://lore.kernel.org/r/20241004030512.2036-1-sakunix%40yahoo.com patch subject: [PATCH] USB: atm: speedtch: do not use assignment in if condition config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20241005/202410051744.I4PVYrMx-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/20241005/202410051744.I4PVYrMx-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/202410051744.I4PVYrMx-lkp@xxxxxxxxx/ All warnings (new ones prefixed by >>): drivers/usb/atm/speedtch.c: In function 'speedtch_upload_firmware': drivers/usb/atm/speedtch.c:327:85: error: expected ')' before 'if' 327 | ret = usb_set_interface(usb_dev, INTERFACE_DATA, instance->params.altsetting | ~ ^ | ) 328 | 329 | if (ret < 0) { | ~~ drivers/usb/atm/speedtch.c:346:20: error: expected ';' before '}' token 346 | return ret; | ^ | ; 347 | } | ~ drivers/usb/atm/speedtch.c:317:17: error: label 'out_free' used but not defined 317 | goto out_free; | ^~~~ drivers/usb/atm/speedtch.c:247:17: error: label 'out' used but not defined 247 | goto out; | ^~~~ >> drivers/usb/atm/speedtch.c:347:1: warning: control reaches end of non-void function [-Wreturn-type] 347 | } | ^ drivers/usb/atm/speedtch.c: At top level: drivers/usb/atm/speedtch.c:160:13: warning: 'speedtch_test_sequence' defined but not used [-Wunused-function] 160 | static void speedtch_test_sequence(struct speedtch_instance_data *instance) | ^~~~~~~~~~~~~~~~~~~~~~ drivers/usb/atm/speedtch.c:144:13: warning: 'speedtch_set_swbuff' defined but not used [-Wunused-function] 144 | static void speedtch_set_swbuff(struct speedtch_instance_data *instance, int state) | ^~~~~~~~~~~~~~~~~~~ vim +347 drivers/usb/atm/speedtch.c ^1da177e4c3f41 Linus Torvalds 2005-04-16 229 48da7267ff1631 Duncan Sands 2005-05-11 230 static int speedtch_upload_firmware(struct speedtch_instance_data *instance, 48da7267ff1631 Duncan Sands 2005-05-11 231 const struct firmware *fw1, 48da7267ff1631 Duncan Sands 2005-05-11 232 const struct firmware *fw2) ^1da177e4c3f41 Linus Torvalds 2005-04-16 233 { 48da7267ff1631 Duncan Sands 2005-05-11 234 unsigned char *buffer; 48da7267ff1631 Duncan Sands 2005-05-11 235 struct usbatm_data *usbatm = instance->usbatm; 48da7267ff1631 Duncan Sands 2005-05-11 236 struct usb_device *usb_dev = usbatm->usb_dev; 48da7267ff1631 Duncan Sands 2005-05-11 237 int actual_length; 48da7267ff1631 Duncan Sands 2005-05-11 238 int ret = 0; 48da7267ff1631 Duncan Sands 2005-05-11 239 int offset; 48da7267ff1631 Duncan Sands 2005-05-11 240 48da7267ff1631 Duncan Sands 2005-05-11 241 usb_dbg(usbatm, "%s entered\n", __func__); 48da7267ff1631 Duncan Sands 2005-05-11 242 3383ee4c3abf2e Greg Kroah-Hartman 2015-04-30 243 buffer = (unsigned char *)__get_free_page(GFP_KERNEL); 3383ee4c3abf2e Greg Kroah-Hartman 2015-04-30 244 if (!buffer) { 48da7267ff1631 Duncan Sands 2005-05-11 245 ret = -ENOMEM; 48da7267ff1631 Duncan Sands 2005-05-11 246 usb_dbg(usbatm, "%s: no memory for buffer!\n", __func__); 48da7267ff1631 Duncan Sands 2005-05-11 247 goto out; 48da7267ff1631 Duncan Sands 2005-05-11 248 } 48da7267ff1631 Duncan Sands 2005-05-11 249 011db815231f40 Micah Gruber 2007-09-05 250 if (!usb_ifnum_to_if(usb_dev, 2)) { 48da7267ff1631 Duncan Sands 2005-05-11 251 ret = -ENODEV; 48da7267ff1631 Duncan Sands 2005-05-11 252 usb_dbg(usbatm, "%s: interface not found!\n", __func__); 48da7267ff1631 Duncan Sands 2005-05-11 253 goto out_free; 48da7267ff1631 Duncan Sands 2005-05-11 254 } 48da7267ff1631 Duncan Sands 2005-05-11 255 48da7267ff1631 Duncan Sands 2005-05-11 256 /* URB 7 */ 48da7267ff1631 Duncan Sands 2005-05-11 257 if (dl_512_first) { /* some modems need a read before writing the firmware */ 48da7267ff1631 Duncan Sands 2005-05-11 258 ret = usb_bulk_msg(usb_dev, usb_rcvbulkpipe(usb_dev, ENDPOINT_FIRMWARE), 48da7267ff1631 Duncan Sands 2005-05-11 259 buffer, 0x200, &actual_length, 2000); 48da7267ff1631 Duncan Sands 2005-05-11 260 48da7267ff1631 Duncan Sands 2005-05-11 261 if (ret < 0 && ret != -ETIMEDOUT) 0ec3c7e856319b Duncan Sands 2006-01-17 262 usb_warn(usbatm, "%s: read BLOCK0 from modem failed (%d)!\n", __func__, ret); 48da7267ff1631 Duncan Sands 2005-05-11 263 else 48da7267ff1631 Duncan Sands 2005-05-11 264 usb_dbg(usbatm, "%s: BLOCK0 downloaded (%d bytes)\n", __func__, ret); 48da7267ff1631 Duncan Sands 2005-05-11 265 } 48da7267ff1631 Duncan Sands 2005-05-11 266 48da7267ff1631 Duncan Sands 2005-05-11 267 /* URB 8 : both leds are static green */ 48da7267ff1631 Duncan Sands 2005-05-11 268 for (offset = 0; offset < fw1->size; offset += PAGE_SIZE) { 48da7267ff1631 Duncan Sands 2005-05-11 269 int thislen = min_t(int, PAGE_SIZE, fw1->size - offset); 48da7267ff1631 Duncan Sands 2005-05-11 270 memcpy(buffer, fw1->data + offset, thislen); 48da7267ff1631 Duncan Sands 2005-05-11 271 48da7267ff1631 Duncan Sands 2005-05-11 272 ret = usb_bulk_msg(usb_dev, usb_sndbulkpipe(usb_dev, ENDPOINT_FIRMWARE), 48da7267ff1631 Duncan Sands 2005-05-11 273 buffer, thislen, &actual_length, DATA_TIMEOUT); 48da7267ff1631 Duncan Sands 2005-05-11 274 48da7267ff1631 Duncan Sands 2005-05-11 275 if (ret < 0) { 0ec3c7e856319b Duncan Sands 2006-01-17 276 usb_err(usbatm, "%s: write BLOCK1 to modem failed (%d)!\n", __func__, ret); 48da7267ff1631 Duncan Sands 2005-05-11 277 goto out_free; 48da7267ff1631 Duncan Sands 2005-05-11 278 } 48da7267ff1631 Duncan Sands 2005-05-11 279 usb_dbg(usbatm, "%s: BLOCK1 uploaded (%zu bytes)\n", __func__, fw1->size); 48da7267ff1631 Duncan Sands 2005-05-11 280 } 48da7267ff1631 Duncan Sands 2005-05-11 281 48da7267ff1631 Duncan Sands 2005-05-11 282 /* USB led blinking green, ADSL led off */ 48da7267ff1631 Duncan Sands 2005-05-11 283 48da7267ff1631 Duncan Sands 2005-05-11 284 /* URB 11 */ 48da7267ff1631 Duncan Sands 2005-05-11 285 ret = usb_bulk_msg(usb_dev, usb_rcvbulkpipe(usb_dev, ENDPOINT_FIRMWARE), 48da7267ff1631 Duncan Sands 2005-05-11 286 buffer, 0x200, &actual_length, DATA_TIMEOUT); 48da7267ff1631 Duncan Sands 2005-05-11 287 48da7267ff1631 Duncan Sands 2005-05-11 288 if (ret < 0) { 0ec3c7e856319b Duncan Sands 2006-01-17 289 usb_err(usbatm, "%s: read BLOCK2 from modem failed (%d)!\n", __func__, ret); 48da7267ff1631 Duncan Sands 2005-05-11 290 goto out_free; 48da7267ff1631 Duncan Sands 2005-05-11 291 } 48da7267ff1631 Duncan Sands 2005-05-11 292 usb_dbg(usbatm, "%s: BLOCK2 downloaded (%d bytes)\n", __func__, actual_length); 48da7267ff1631 Duncan Sands 2005-05-11 293 48da7267ff1631 Duncan Sands 2005-05-11 294 /* URBs 12 to 139 - USB led blinking green, ADSL led off */ 48da7267ff1631 Duncan Sands 2005-05-11 295 for (offset = 0; offset < fw2->size; offset += PAGE_SIZE) { 48da7267ff1631 Duncan Sands 2005-05-11 296 int thislen = min_t(int, PAGE_SIZE, fw2->size - offset); 48da7267ff1631 Duncan Sands 2005-05-11 297 memcpy(buffer, fw2->data + offset, thislen); 48da7267ff1631 Duncan Sands 2005-05-11 298 48da7267ff1631 Duncan Sands 2005-05-11 299 ret = usb_bulk_msg(usb_dev, usb_sndbulkpipe(usb_dev, ENDPOINT_FIRMWARE), 48da7267ff1631 Duncan Sands 2005-05-11 300 buffer, thislen, &actual_length, DATA_TIMEOUT); 48da7267ff1631 Duncan Sands 2005-05-11 301 48da7267ff1631 Duncan Sands 2005-05-11 302 if (ret < 0) { 0ec3c7e856319b Duncan Sands 2006-01-17 303 usb_err(usbatm, "%s: write BLOCK3 to modem failed (%d)!\n", __func__, ret); 48da7267ff1631 Duncan Sands 2005-05-11 304 goto out_free; 48da7267ff1631 Duncan Sands 2005-05-11 305 } 48da7267ff1631 Duncan Sands 2005-05-11 306 } 48da7267ff1631 Duncan Sands 2005-05-11 307 usb_dbg(usbatm, "%s: BLOCK3 uploaded (%zu bytes)\n", __func__, fw2->size); 48da7267ff1631 Duncan Sands 2005-05-11 308 48da7267ff1631 Duncan Sands 2005-05-11 309 /* USB led static green, ADSL led static red */ 48da7267ff1631 Duncan Sands 2005-05-11 310 48da7267ff1631 Duncan Sands 2005-05-11 311 /* URB 142 */ 48da7267ff1631 Duncan Sands 2005-05-11 312 ret = usb_bulk_msg(usb_dev, usb_rcvbulkpipe(usb_dev, ENDPOINT_FIRMWARE), 48da7267ff1631 Duncan Sands 2005-05-11 313 buffer, 0x200, &actual_length, DATA_TIMEOUT); ^1da177e4c3f41 Linus Torvalds 2005-04-16 314 ^1da177e4c3f41 Linus Torvalds 2005-04-16 315 if (ret < 0) { 0ec3c7e856319b Duncan Sands 2006-01-17 316 usb_err(usbatm, "%s: read BLOCK4 from modem failed (%d)!\n", __func__, ret); 48da7267ff1631 Duncan Sands 2005-05-11 317 goto out_free; 48da7267ff1631 Duncan Sands 2005-05-11 318 } 48da7267ff1631 Duncan Sands 2005-05-11 319 48da7267ff1631 Duncan Sands 2005-05-11 320 /* success */ 48da7267ff1631 Duncan Sands 2005-05-11 321 usb_dbg(usbatm, "%s: BLOCK4 downloaded (%d bytes)\n", __func__, actual_length); 48da7267ff1631 Duncan Sands 2005-05-11 322 48da7267ff1631 Duncan Sands 2005-05-11 323 /* Delay to allow firmware to start up. We can do this here 48da7267ff1631 Duncan Sands 2005-05-11 324 because we're in our own kernel thread anyway. */ 48da7267ff1631 Duncan Sands 2005-05-11 325 msleep_interruptible(1000); 48da7267ff1631 Duncan Sands 2005-05-11 326 a23b48ae442d5f Manuel Quintero F 2024-10-03 327 ret = usb_set_interface(usb_dev, INTERFACE_DATA, instance->params.altsetting a23b48ae442d5f Manuel Quintero F 2024-10-03 328 a23b48ae442d5f Manuel Quintero F 2024-10-03 329 if (ret < 0) { 6a4f1b41357d2b Duncan Sands 2006-10-05 330 usb_err(usbatm, "%s: setting interface to %d failed (%d)!\n", __func__, instance->params.altsetting, ret); 6f7494759870ec Duncan Sands 2006-01-13 331 goto out_free; 6f7494759870ec Duncan Sands 2006-01-13 332 } 6f7494759870ec Duncan Sands 2006-01-13 333 48da7267ff1631 Duncan Sands 2005-05-11 334 /* Enable software buffering, if requested */ 48da7267ff1631 Duncan Sands 2005-05-11 335 if (sw_buffering) 48da7267ff1631 Duncan Sands 2005-05-11 336 speedtch_set_swbuff(instance, 1); 48da7267ff1631 Duncan Sands 2005-05-11 337 48da7267ff1631 Duncan Sands 2005-05-11 338 /* Magic spell; don't ask us what this does */ 48da7267ff1631 Duncan Sands 2005-05-11 339 speedtch_test_sequence(instance); 48da7267ff1631 Duncan Sands 2005-05-11 340 48da7267ff1631 Duncan Sands 2005-05-11 341 ret = 0; 48da7267ff1631 Duncan Sands 2005-05-11 342 48da7267ff1631 Duncan Sands 2005-05-11 343 out_free: 48da7267ff1631 Duncan Sands 2005-05-11 344 free_page((unsigned long)buffer); 48da7267ff1631 Duncan Sands 2005-05-11 345 out: ^1da177e4c3f41 Linus Torvalds 2005-04-16 346 return ret; ^1da177e4c3f41 Linus Torvalds 2005-04-16 @347 } ^1da177e4c3f41 Linus Torvalds 2005-04-16 348 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki