mirror of https://github.com/acidanthera/audk.git
ShellPkg/UefiHandleParsingLib: Fix issue to pass static code checker
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
This commit is contained in:
parent
51686a7a29
commit
94fcb76b61
|
@ -2421,6 +2421,7 @@ ParseHandleDatabaseByRelationshipWithType (
|
||||||
*HandleType = AllocateZeroPool (*HandleCount * sizeof (UINTN));
|
*HandleType = AllocateZeroPool (*HandleCount * sizeof (UINTN));
|
||||||
if (*HandleType == NULL) {
|
if (*HandleType == NULL) {
|
||||||
SHELL_FREE_NON_NULL (*HandleBuffer);
|
SHELL_FREE_NON_NULL (*HandleBuffer);
|
||||||
|
*HandleCount = 0;
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2678,7 +2679,9 @@ ParseHandleDatabaseByRelationship (
|
||||||
// Allocate a handle buffer for the number of handles that matched the attributes in Mask
|
// Allocate a handle buffer for the number of handles that matched the attributes in Mask
|
||||||
//
|
//
|
||||||
*MatchingHandleBuffer = AllocateZeroPool ((*MatchingHandleCount +1)* sizeof (EFI_HANDLE));
|
*MatchingHandleBuffer = AllocateZeroPool ((*MatchingHandleCount +1)* sizeof (EFI_HANDLE));
|
||||||
if (*MatchingHandleBuffer != NULL) {
|
if (*MatchingHandleBuffer == NULL) {
|
||||||
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
|
} else {
|
||||||
for (HandleIndex = 0, *MatchingHandleCount = 0
|
for (HandleIndex = 0, *MatchingHandleCount = 0
|
||||||
; HandleIndex < HandleCount
|
; HandleIndex < HandleCount
|
||||||
; HandleIndex++
|
; HandleIndex++
|
||||||
|
@ -2697,7 +2700,7 @@ ParseHandleDatabaseByRelationship (
|
||||||
(*MatchingHandleBuffer)[*MatchingHandleCount] = NULL;
|
(*MatchingHandleBuffer)[*MatchingHandleCount] = NULL;
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
} // *MatchingHandleBuffer != NULL (IF)
|
} // *MatchingHandleBuffer == NULL (ELSE)
|
||||||
} // MacthingHandleBuffer == NULL (ELSE)
|
} // MacthingHandleBuffer == NULL (ELSE)
|
||||||
} // *MatchingHandleCount == 0 (ELSE)
|
} // *MatchingHandleCount == 0 (ELSE)
|
||||||
} // no error on ParseHandleDatabaseByRelationshipWithType
|
} // no error on ParseHandleDatabaseByRelationshipWithType
|
||||||
|
@ -2710,6 +2713,9 @@ ParseHandleDatabaseByRelationship (
|
||||||
FreePool (HandleType);
|
FreePool (HandleType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ASSERT ((MatchingHandleBuffer == NULL) ||
|
||||||
|
(*MatchingHandleCount == 0 && *MatchingHandleBuffer == NULL) ||
|
||||||
|
(*MatchingHandleCount != 0 && *MatchingHandleBuffer != NULL));
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2801,6 +2807,9 @@ ParseHandleDatabaseForChildControllers(
|
||||||
} else {
|
} else {
|
||||||
FreePool(HandleBufferForReturn);
|
FreePool(HandleBufferForReturn);
|
||||||
}
|
}
|
||||||
|
ASSERT ((MatchingHandleBuffer == NULL) ||
|
||||||
|
(*MatchingHandleCount == 0 && *MatchingHandleBuffer == NULL) ||
|
||||||
|
(*MatchingHandleCount != 0 && *MatchingHandleBuffer != NULL));
|
||||||
|
|
||||||
return (EFI_SUCCESS);
|
return (EFI_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue