File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -4920,12 +4920,6 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg)
4920
4920
epnum , 0 );
4921
4921
}
4922
4922
4923
- ret = usb_add_gadget_udc (dev , & hsotg -> gadget );
4924
- if (ret ) {
4925
- dwc2_hsotg_ep_free_request (& hsotg -> eps_out [0 ]-> ep ,
4926
- hsotg -> ctrl_req );
4927
- return ret ;
4928
- }
4929
4923
dwc2_hsotg_dump (hsotg );
4930
4924
4931
4925
return 0 ;
Original file line number Diff line number Diff line change @@ -575,6 +575,17 @@ static int dwc2_driver_probe(struct platform_device *dev)
575
575
if (hsotg -> dr_mode == USB_DR_MODE_PERIPHERAL )
576
576
dwc2_lowlevel_hw_disable (hsotg );
577
577
578
+ #if IS_ENABLED (CONFIG_USB_DWC2_PERIPHERAL ) || \
579
+ IS_ENABLED (CONFIG_USB_DWC2_DUAL_ROLE )
580
+ /* Postponed adding a new gadget to the udc class driver list */
581
+ if (hsotg -> gadget_enabled ) {
582
+ retval = usb_add_gadget_udc (hsotg -> dev , & hsotg -> gadget );
583
+ if (retval ) {
584
+ dwc2_hsotg_remove (hsotg );
585
+ goto error_init ;
586
+ }
587
+ }
588
+ #endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */
578
589
return 0 ;
579
590
580
591
error_init :
You can’t perform that action at this time.
0 commit comments