add error handling on usb related modules.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9566 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -849,7 +849,8 @@ UsbIoPortReset (
|
||||
Address = Dev->Address;
|
||||
Dev->Address = 0;
|
||||
Status = UsbSetAddress (Dev, Address);
|
||||
Dev->Address = Address;
|
||||
|
||||
gBS->Stall (USB_SET_DEVICE_ADDRESS_STALL);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG (( EFI_D_ERROR, "UsbIoPortReset: failed to set address for device %d - %r\n",
|
||||
@@ -858,7 +859,7 @@ UsbIoPortReset (
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
gBS->Stall (USB_SET_DEVICE_ADDRESS_STALL);
|
||||
Dev->Address = Address;
|
||||
|
||||
DEBUG (( EFI_D_INFO, "UsbIoPortReset: device is now ADDRESSED at %d\n", Address));
|
||||
|
||||
|
@@ -42,7 +42,12 @@ UsbFreeInterfaceDesc (
|
||||
}
|
||||
}
|
||||
|
||||
FreePool (Setting->Endpoints);
|
||||
//
|
||||
// Only call FreePool() if NumEndpoints > 0.
|
||||
//
|
||||
if (Setting->Desc.NumEndpoints > 0) {
|
||||
FreePool (Setting->Endpoints);
|
||||
}
|
||||
}
|
||||
|
||||
FreePool (Setting);
|
||||
@@ -192,10 +197,13 @@ UsbCreateDesc (
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Desc = AllocateCopyPool(CtrlLen, Head);
|
||||
Desc = AllocateZeroPool (CtrlLen);
|
||||
if (Desc == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CopyMem (Desc, Head, DescLen);
|
||||
|
||||
*Consumed = Offset + Head->Len;
|
||||
|
||||
return Desc;
|
||||
@@ -344,7 +352,11 @@ UsbParseConfigDesc (
|
||||
DescBuf += Consumed;
|
||||
Len -= Consumed;
|
||||
|
||||
while (Len > 0) {
|
||||
//
|
||||
// Make allowances for devices that return extra data at the
|
||||
// end of their config descriptors
|
||||
//
|
||||
while (Len >= sizeof (EFI_USB_INTERFACE_DESCRIPTOR)) {
|
||||
Setting = UsbParseInterfaceDesc (DescBuf, Len, &Consumed);
|
||||
|
||||
if ((Setting == NULL)) {
|
||||
|
Reference in New Issue
Block a user