mirror of https://github.com/acidanthera/audk.git
add assert logic to avoid Klocwork fake report
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7511 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
c55426ab64
commit
a1b749d074
|
@ -111,6 +111,7 @@ UsbIoControlTransfer (
|
||||||
// Clear TT buffer when CTRL/BULK split transaction failes
|
// Clear TT buffer when CTRL/BULK split transaction failes
|
||||||
// Clear the TRANSLATOR TT buffer, not parent's buffer
|
// Clear the TRANSLATOR TT buffer, not parent's buffer
|
||||||
//
|
//
|
||||||
|
ASSERT (Dev->Translator.TranslatorHubAddress < USB_MAX_DEVICES);
|
||||||
if (Dev->Translator.TranslatorHubAddress != 0) {
|
if (Dev->Translator.TranslatorHubAddress != 0) {
|
||||||
UsbHubCtrlClearTTBuffer (
|
UsbHubCtrlClearTTBuffer (
|
||||||
Dev->Bus->Devices[Dev->Translator.TranslatorHubAddress],
|
Dev->Bus->Devices[Dev->Translator.TranslatorHubAddress],
|
||||||
|
@ -195,6 +196,7 @@ UsbIoControlTransfer (
|
||||||
Status = UsbSelectSetting (UsbIf->IfDesc, (UINT8) Request->Value);
|
Status = UsbSelectSetting (UsbIf->IfDesc, (UINT8) Request->Value);
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
|
ASSERT (UsbIf->IfDesc->ActiveIndex < USB_MAX_INTERFACE_SETTING);
|
||||||
UsbIf->IfSetting = UsbIf->IfDesc->Settings[UsbIf->IfDesc->ActiveIndex];
|
UsbIf->IfSetting = UsbIf->IfDesc->Settings[UsbIf->IfDesc->ActiveIndex];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,6 +284,7 @@ UsbIoBulkTransfer (
|
||||||
// Clear TT buffer when CTRL/BULK split transaction failes.
|
// Clear TT buffer when CTRL/BULK split transaction failes.
|
||||||
// Clear the TRANSLATOR TT buffer, not parent's buffer
|
// Clear the TRANSLATOR TT buffer, not parent's buffer
|
||||||
//
|
//
|
||||||
|
ASSERT (Dev->Translator.TranslatorHubAddress < USB_MAX_DEVICES);
|
||||||
if (Dev->Translator.TranslatorHubAddress != 0) {
|
if (Dev->Translator.TranslatorHubAddress != 0) {
|
||||||
UsbHubCtrlClearTTBuffer (
|
UsbHubCtrlClearTTBuffer (
|
||||||
Dev->Bus->Devices[Dev->Translator.TranslatorHubAddress],
|
Dev->Bus->Devices[Dev->Translator.TranslatorHubAddress],
|
||||||
|
@ -751,6 +754,7 @@ UsbIoGetStringDescriptor (
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
|
|
||||||
for (Index = 0; Index < Dev->TotalLangId; Index++) {
|
for (Index = 0; Index < Dev->TotalLangId; Index++) {
|
||||||
|
ASSERT (Index < USB_MAX_LANG_ID);
|
||||||
if (Dev->LangId[Index] == LangID) {
|
if (Dev->LangId[Index] == LangID) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,6 +109,7 @@ UsbCreateInterface (
|
||||||
UsbIf->Signature = USB_INTERFACE_SIGNATURE;
|
UsbIf->Signature = USB_INTERFACE_SIGNATURE;
|
||||||
UsbIf->Device = Device;
|
UsbIf->Device = Device;
|
||||||
UsbIf->IfDesc = IfDesc;
|
UsbIf->IfDesc = IfDesc;
|
||||||
|
ASSERT (IfDesc->ActiveIndex < USB_MAX_INTERFACE_SETTING);
|
||||||
UsbIf->IfSetting = IfDesc->Settings[IfDesc->ActiveIndex];
|
UsbIf->IfSetting = IfDesc->Settings[IfDesc->ActiveIndex];
|
||||||
|
|
||||||
CopyMem (
|
CopyMem (
|
||||||
|
@ -279,7 +280,7 @@ UsbConnectDriver (
|
||||||
//
|
//
|
||||||
if (UsbBusIsWantedUsbIO (UsbIf->Device->Bus, UsbIf)) {
|
if (UsbBusIsWantedUsbIO (UsbIf->Device->Bus, UsbIf)) {
|
||||||
OldTpl = UsbGetCurrentTpl ();
|
OldTpl = UsbGetCurrentTpl ();
|
||||||
DEBUG ((EFI_D_INFO, "UsbConnectDriver: TPL before connect is %d\n", (UINT32)OldTpl));
|
DEBUG ((EFI_D_INFO, "UsbConnectDriver: TPL before connect is %d, %p\n", (UINT32)OldTpl, UsbIf->Handle));
|
||||||
|
|
||||||
gBS->RestoreTPL (TPL_CALLBACK);
|
gBS->RestoreTPL (TPL_CALLBACK);
|
||||||
|
|
||||||
|
@ -325,6 +326,7 @@ UsbSelectSetting (
|
||||||
Setting = NULL;
|
Setting = NULL;
|
||||||
|
|
||||||
for (Index = 0; Index < IfDesc->NumOfSetting; Index++) {
|
for (Index = 0; Index < IfDesc->NumOfSetting; Index++) {
|
||||||
|
ASSERT (Index < USB_MAX_INTERFACE_SETTING);
|
||||||
Setting = IfDesc->Settings[Index];
|
Setting = IfDesc->Settings[Index];
|
||||||
|
|
||||||
if (Setting->Desc.AlternateSetting == Alternate) {
|
if (Setting->Desc.AlternateSetting == Alternate) {
|
||||||
|
@ -420,6 +422,7 @@ UsbSelectConfig (
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ASSERT (Index < USB_MAX_INTERFACE);
|
||||||
Device->Interfaces[Index] = UsbIf;
|
Device->Interfaces[Index] = UsbIf;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -452,6 +455,7 @@ UsbDisconnectDriver (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_TPL OldTpl;
|
EFI_TPL OldTpl;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Release the hub if it's a hub controller, otherwise
|
// Release the hub if it's a hub controller, otherwise
|
||||||
|
@ -469,14 +473,14 @@ UsbDisconnectDriver (
|
||||||
// or disconnect at CALLBACK.
|
// or disconnect at CALLBACK.
|
||||||
//
|
//
|
||||||
OldTpl = UsbGetCurrentTpl ();
|
OldTpl = UsbGetCurrentTpl ();
|
||||||
DEBUG ((EFI_D_INFO, "UsbDisconnectDriver: old TPL is %d\n", (UINT32)OldTpl));
|
DEBUG ((EFI_D_INFO, "UsbDisconnectDriver: old TPL is %d, %p\n", (UINT32)OldTpl, UsbIf->Handle));
|
||||||
|
|
||||||
gBS->RestoreTPL (TPL_CALLBACK);
|
gBS->RestoreTPL (TPL_CALLBACK);
|
||||||
|
|
||||||
gBS->DisconnectController (UsbIf->Handle, NULL, NULL);
|
Status = gBS->DisconnectController (UsbIf->Handle, NULL, NULL);
|
||||||
UsbIf->IsManaged = FALSE;
|
UsbIf->IsManaged = FALSE;
|
||||||
|
|
||||||
DEBUG (( EFI_D_INFO, "UsbDisconnectDriver: TPL after disconnect is %d\n", (UINT32)UsbGetCurrentTpl()));
|
DEBUG (( EFI_D_INFO, "UsbDisconnectDriver: TPL after disconnect is %d, %d\n", (UINT32)UsbGetCurrentTpl(), Status));
|
||||||
ASSERT (UsbGetCurrentTpl () == TPL_CALLBACK);
|
ASSERT (UsbGetCurrentTpl () == TPL_CALLBACK);
|
||||||
|
|
||||||
gBS->RaiseTPL (OldTpl);
|
gBS->RaiseTPL (OldTpl);
|
||||||
|
@ -502,6 +506,7 @@ UsbRemoveConfig (
|
||||||
// Remove each interface of the device
|
// Remove each interface of the device
|
||||||
//
|
//
|
||||||
for (Index = 0; Index < Device->NumOfInterface; Index++) {
|
for (Index = 0; Index < Device->NumOfInterface; Index++) {
|
||||||
|
ASSERT (Index < USB_MAX_INTERFACE);
|
||||||
UsbIf = Device->Interfaces[Index];
|
UsbIf = Device->Interfaces[Index];
|
||||||
|
|
||||||
if (UsbIf == NULL) {
|
if (UsbIf == NULL) {
|
||||||
|
@ -561,6 +566,7 @@ UsbRemoveDevice (
|
||||||
|
|
||||||
DEBUG (( EFI_D_INFO, "UsbRemoveDevice: device %d removed\n", Device->Address));
|
DEBUG (( EFI_D_INFO, "UsbRemoveDevice: device %d removed\n", Device->Address));
|
||||||
|
|
||||||
|
ASSERT (Device->Address < USB_MAX_DEVICES);
|
||||||
Bus->Devices[Device->Address] = NULL;
|
Bus->Devices[Device->Address] = NULL;
|
||||||
UsbFreeDevice (Device);
|
UsbFreeDevice (Device);
|
||||||
|
|
||||||
|
@ -900,7 +906,7 @@ UsbEnumeratePort (
|
||||||
Child = UsbFindChild (HubIf, Port);
|
Child = UsbFindChild (HubIf, Port);
|
||||||
|
|
||||||
if (Child != NULL) {
|
if (Child != NULL) {
|
||||||
DEBUG (( EFI_D_INFO, "UsbEnumeratePort: device at port %d removed from system\n", Port));
|
DEBUG (( EFI_D_INFO, "UsbEnumeratePort: device at port %d removed from root hub %p\n", Port, HubIf));
|
||||||
UsbRemoveDevice (Child);
|
UsbRemoveDevice (Child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -928,6 +928,7 @@ MatchUsbClass (
|
||||||
}
|
}
|
||||||
|
|
||||||
IfDesc = UsbIf->IfDesc;
|
IfDesc = UsbIf->IfDesc;
|
||||||
|
ASSERT (IfDesc->ActiveIndex < USB_MAX_INTERFACE_SETTING);
|
||||||
ActIfDesc = &(IfDesc->Settings[IfDesc->ActiveIndex]->Desc);
|
ActIfDesc = &(IfDesc->Settings[IfDesc->ActiveIndex]->Desc);
|
||||||
DevDesc = &(UsbIf->Device->DevDesc->Desc);
|
DevDesc = &(UsbIf->Device->DevDesc->Desc);
|
||||||
|
|
||||||
|
@ -1008,6 +1009,7 @@ MatchUsbWwid (
|
||||||
}
|
}
|
||||||
|
|
||||||
IfDesc = UsbIf->IfDesc;
|
IfDesc = UsbIf->IfDesc;
|
||||||
|
ASSERT (IfDesc->ActiveIndex < USB_MAX_INTERFACE_SETTING);
|
||||||
ActIfDesc = &(IfDesc->Settings[IfDesc->ActiveIndex]->Desc);
|
ActIfDesc = &(IfDesc->Settings[IfDesc->ActiveIndex]->Desc);
|
||||||
DevDesc = &(UsbIf->Device->DevDesc->Desc);
|
DevDesc = &(UsbIf->Device->DevDesc->Desc);
|
||||||
StrDesc = UsbGetOneString (UsbIf->Device, DevDesc->StrSerialNumber, USB_US_LAND_ID);
|
StrDesc = UsbGetOneString (UsbIf->Device, DevDesc->StrSerialNumber, USB_US_LAND_ID);
|
||||||
|
|
Loading…
Reference in New Issue