tree: https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git testing/next head: a1ff2f6769e39055e973b068070aeea0b3bcd90f commit: 602fb68e303fb96c9e4a5eb5f25ad0ce999df37d [40/48] usb: dwc2: Add missing cleanups when usb_add_gadget_udc() fails config: x86_64-randconfig-a004-20200726 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 8bf4c1f4fb257774f66c8cda07adc6c5e8668326) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install x86_64 cross compiling tool for clang build # apt-get install binutils-x86-64-linux-gnu git checkout 602fb68e303fb96c9e4a5eb5f25ad0ce999df37d # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> All warnings (new ones prefixed by >>): >> drivers/usb/dwc2/platform.c:593:1: warning: unused label 'error_debugfs' [-Wunused-label] error_debugfs: ^~~~~~~~~~~~~~ 1 warning generated. vim +/error_debugfs +593 drivers/usb/dwc2/platform.c 396 397 /** 398 * dwc2_driver_probe() - Called when the DWC_otg core is bound to the DWC_otg 399 * driver 400 * 401 * @dev: Platform device 402 * 403 * This routine creates the driver components required to control the device 404 * (core, HCD, and PCD) and initializes the device. The driver components are 405 * stored in a dwc2_hsotg structure. A reference to the dwc2_hsotg is saved 406 * in the device private data. This allows the driver to access the dwc2_hsotg 407 * structure on subsequent calls to driver methods for this device. 408 */ 409 static int dwc2_driver_probe(struct platform_device *dev) 410 { 411 struct dwc2_hsotg *hsotg; 412 struct resource *res; 413 int retval; 414 415 hsotg = devm_kzalloc(&dev->dev, sizeof(*hsotg), GFP_KERNEL); 416 if (!hsotg) 417 return -ENOMEM; 418 419 hsotg->dev = &dev->dev; 420 421 /* 422 * Use reasonable defaults so platforms don't have to provide these. 423 */ 424 if (!dev->dev.dma_mask) 425 dev->dev.dma_mask = &dev->dev.coherent_dma_mask; 426 retval = dma_set_coherent_mask(&dev->dev, DMA_BIT_MASK(32)); 427 if (retval) { 428 dev_err(&dev->dev, "can't set coherent DMA mask: %d\n", retval); 429 return retval; 430 } 431 432 hsotg->regs = devm_platform_get_and_ioremap_resource(dev, 0, &res); 433 if (IS_ERR(hsotg->regs)) 434 return PTR_ERR(hsotg->regs); 435 436 dev_dbg(&dev->dev, "mapped PA %08lx to VA %p\n", 437 (unsigned long)res->start, hsotg->regs); 438 439 retval = dwc2_lowlevel_hw_init(hsotg); 440 if (retval) 441 return retval; 442 443 spin_lock_init(&hsotg->lock); 444 445 hsotg->irq = platform_get_irq(dev, 0); 446 if (hsotg->irq < 0) 447 return hsotg->irq; 448 449 dev_dbg(hsotg->dev, "registering common handler for irq%d\n", 450 hsotg->irq); 451 retval = devm_request_irq(hsotg->dev, hsotg->irq, 452 dwc2_handle_common_intr, IRQF_SHARED, 453 dev_name(hsotg->dev), hsotg); 454 if (retval) 455 return retval; 456 457 hsotg->vbus_supply = devm_regulator_get_optional(hsotg->dev, "vbus"); 458 if (IS_ERR(hsotg->vbus_supply)) { 459 retval = PTR_ERR(hsotg->vbus_supply); 460 hsotg->vbus_supply = NULL; 461 if (retval != -ENODEV) 462 return retval; 463 } 464 465 retval = dwc2_lowlevel_hw_enable(hsotg); 466 if (retval) 467 return retval; 468 469 hsotg->needs_byte_swap = dwc2_check_core_endianness(hsotg); 470 471 retval = dwc2_get_dr_mode(hsotg); 472 if (retval) 473 goto error; 474 475 hsotg->need_phy_for_wake = 476 of_property_read_bool(dev->dev.of_node, 477 "snps,need-phy-for-wake"); 478 479 /* 480 * Before performing any core related operations 481 * check core version. 482 */ 483 retval = dwc2_check_core_version(hsotg); 484 if (retval) 485 goto error; 486 487 /* 488 * Reset before dwc2_get_hwparams() then it could get power-on real 489 * reset value form registers. 490 */ 491 retval = dwc2_core_reset(hsotg, false); 492 if (retval) 493 goto error; 494 495 /* Detect config values from hardware */ 496 retval = dwc2_get_hwparams(hsotg); 497 if (retval) 498 goto error; 499 500 /* 501 * For OTG cores, set the force mode bits to reflect the value 502 * of dr_mode. Force mode bits should not be touched at any 503 * other time after this. 504 */ 505 dwc2_force_dr_mode(hsotg); 506 507 retval = dwc2_init_params(hsotg); 508 if (retval) 509 goto error; 510 511 if (hsotg->params.activate_stm_id_vb_detection) { 512 u32 ggpio; 513 514 hsotg->usb33d = devm_regulator_get(hsotg->dev, "usb33d"); 515 if (IS_ERR(hsotg->usb33d)) { 516 retval = PTR_ERR(hsotg->usb33d); 517 if (retval != -EPROBE_DEFER) 518 dev_err(hsotg->dev, 519 "failed to request usb33d supply: %d\n", 520 retval); 521 goto error; 522 } 523 retval = regulator_enable(hsotg->usb33d); 524 if (retval) { 525 dev_err(hsotg->dev, 526 "failed to enable usb33d supply: %d\n", retval); 527 goto error; 528 } 529 530 ggpio = dwc2_readl(hsotg, GGPIO); 531 ggpio |= GGPIO_STM32_OTG_GCCFG_IDEN; 532 ggpio |= GGPIO_STM32_OTG_GCCFG_VBDEN; 533 dwc2_writel(hsotg, ggpio, GGPIO); 534 } 535 536 if (hsotg->dr_mode != USB_DR_MODE_HOST) { 537 retval = dwc2_gadget_init(hsotg); 538 if (retval) 539 goto error_init; 540 hsotg->gadget_enabled = 1; 541 } 542 543 /* 544 * If we need PHY for wakeup we must be wakeup capable. 545 * When we have a device that can wake without the PHY we 546 * can adjust this condition. 547 */ 548 if (hsotg->need_phy_for_wake) 549 device_set_wakeup_capable(&dev->dev, true); 550 551 hsotg->reset_phy_on_wake = 552 of_property_read_bool(dev->dev.of_node, 553 "snps,reset-phy-on-wake"); 554 if (hsotg->reset_phy_on_wake && !hsotg->phy) { 555 dev_warn(hsotg->dev, 556 "Quirk reset-phy-on-wake only supports generic PHYs\n"); 557 hsotg->reset_phy_on_wake = false; 558 } 559 560 if (hsotg->dr_mode != USB_DR_MODE_PERIPHERAL) { 561 retval = dwc2_hcd_init(hsotg); 562 if (retval) { 563 if (hsotg->gadget_enabled) 564 dwc2_hsotg_remove(hsotg); 565 goto error_init; 566 } 567 hsotg->hcd_enabled = 1; 568 } 569 570 platform_set_drvdata(dev, hsotg); 571 hsotg->hibernated = 0; 572 573 dwc2_debugfs_init(hsotg); 574 575 /* Gadget code manages lowlevel hw on its own */ 576 if (hsotg->dr_mode == USB_DR_MODE_PERIPHERAL) 577 dwc2_lowlevel_hw_disable(hsotg); 578 579 #if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || \ 580 IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) 581 /* Postponed adding a new gadget to the udc class driver list */ 582 if (hsotg->gadget_enabled) { 583 retval = usb_add_gadget_udc(hsotg->dev, &hsotg->gadget); 584 if (retval) { 585 hsotg->gadget.udc = NULL; 586 dwc2_hsotg_remove(hsotg); 587 goto error_debugfs; 588 } 589 } 590 #endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */ 591 return 0; 592 > 593 error_debugfs: 594 dwc2_debugfs_exit(hsotg); 595 if (hsotg->hcd_enabled) 596 dwc2_hcd_remove(hsotg); 597 error_init: 598 if (hsotg->params.activate_stm_id_vb_detection) 599 regulator_disable(hsotg->usb33d); 600 error: 601 if (hsotg->dr_mode != USB_DR_MODE_PERIPHERAL) 602 dwc2_lowlevel_hw_disable(hsotg); 603 return retval; 604 } 605 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip