Fix klocwork scanning issues in BootloaderCommonPkg

Fixed several issues reported by klockwork scanning.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
This commit is contained in:
Maurice Ma 2019-08-27 17:10:16 -07:00
parent c3c754a10d
commit 866493b926
3 changed files with 16 additions and 11 deletions

View File

@ -229,9 +229,7 @@ SdCardSendOpCond (
//
// For details, refer to SD Host Controller Simplified Spec 3.0 Table 2-12.
//
if (Argument != NULL) {
*Argument = SdMmcStatusBlk.Resp0;
}
*Argument = SdMmcStatusBlk.Resp0;
}
return Status;

View File

@ -1666,6 +1666,9 @@ MmcSelectPart (
}
Private = MmcGetHcPrivateData();
if (Private == NULL) {
return EFI_NOT_READY;
}
Status = MmcGetExtCsd (Private);
if (EFI_ERROR (Status)) {
@ -1744,6 +1747,10 @@ MmcReadBlocks (
}
Private = MmcGetHcPrivateData();
if (Private == NULL) {
return EFI_NOT_READY;
}
if (DeviceIndex != Private->CurrentPartition) {
Status = MmcSelectPart ((UINT8)DeviceIndex);
if (EFI_ERROR (Status)) {
@ -1783,13 +1790,15 @@ MmcWriteBlocksExt (
EFI_STATUS Status;
SD_MMC_HC_PRIVATE_DATA *Private;
Private = NULL;
if (!MmcIsInitialized()) {
return EFI_NOT_READY;
}
Private = MmcGetHcPrivateData();
if (Private == NULL) {
return EFI_NOT_READY;
}
if (DeviceIndex != Private->CurrentPartition) {
Status = MmcSelectPart ((UINT8)DeviceIndex);
if (EFI_ERROR (Status)) {
@ -1866,6 +1875,9 @@ MmcGetMediaInfo (
}
Private = MmcGetHcPrivateData();
if (Private == NULL) {
return EFI_NOT_READY;
}
if (DeviceIndex != Private->CurrentPartition) {
Status = MmcSelectPart ((UINT8)DeviceIndex);

View File

@ -1078,7 +1078,7 @@ UfsReadBlocks (
ReadSize += ReadBlockSize;
LbaAddress += ReadBlockSize / SIZE_4KB;
}
return Status;
}
@ -1320,11 +1320,6 @@ InitializeUfs (
break;
}
if (Private == NULL) {
Status = EFI_OUT_OF_RESOURCES;
break;
}
CopyMem (Private, &gUfsHcTemplate, sizeof (UFS_PEIM_HC_PRIVATE_DATA));
Private->UfsHcBase = MmioBase;