return EFI_SUCCESS;\r
\r
ON_ERROR:\r
-\r
- if (Child != NULL) {\r
- UsbFreeDevice (Child);\r
- }\r
-\r
+ //\r
+ // If reach here, it means the enumeration process on a given port is interrupted due to error.\r
+ // The s/w resources, including the assigned address(Address) and the allocated usb device data\r
+ // structure(Bus->Devices[Address]), will NOT be freed here. These resources will be freed when\r
+ // the device is unplugged from the port or DriverBindingStop() is invoked.\r
+ //\r
+ // This way is used to co-work with the lower layer EDKII UHCI/EHCI/XHCI host controller driver.\r
+ // It's mainly because to keep UEFI spec unchanged EDKII XHCI driver have to maintain a state machine\r
+ // to keep track of the mapping between actual address and request address. If the request address\r
+ // (Address) is freed here, the Address value will be used by next enumerated device. Then EDKII XHCI\r
+ // host controller driver will have wrong information, which will cause further transaction error.\r
+ //\r
+ // EDKII UHCI/EHCI doesn't get impacted as it's make sense to reserve s/w resource till it gets unplugged.\r
+ //\r
return Status;\r
}\r
\r