MdeModulePkg/Ufs :Coverity scan flags multiple issues in edk2-stable202205

BugZilla ID:https://bugzilla.tianocore.org/show_bug.cgi?id=3989

Added changes to resolve the Coverity Issues in UFS driver

Cc: Vasudevan Sambandan <vasudevans@ami.com>
Cc: Sundaresan Selvaraj <sundaresans@ami.com>
Signed-off-by: Sivaparvathi Chellaiah <sivaparvathic@ami.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
Sivaparvathi C 2022-10-28 12:48:32 +05:30 committed by mergify[bot]
parent eae9e51d98
commit ee3da09bb2
2 changed files with 24 additions and 13 deletions

View File

@ -2,7 +2,7 @@
The DMA memory help function. The DMA memory help function.
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
Copyright (c) 1985 - 2022, American Megatrends International LLC. <BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -240,10 +240,16 @@ IoMmuInit (
VOID VOID
) )
{ {
PeiServicesLocatePpi ( EFI_STATUS Status;
&gEdkiiIoMmuPpiGuid,
0, Status = PeiServicesLocatePpi (
NULL, &gEdkiiIoMmuPpiGuid,
(VOID **)&mIoMmu 0,
); NULL,
(VOID **)&mIoMmu
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_INFO, "Locate mIoMmu Ppi is failed!!!\n"));
}
} }

View File

@ -1,6 +1,7 @@
/** @file /** @file
Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR> Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) 1985 - 2022, American Megatrends International LLC. <BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
@ -18,7 +19,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
UFS_PEIM_MEM_BLOCK * UFS_PEIM_MEM_BLOCK *
UfsPeimAllocMemBlock ( UfsPeimAllocMemBlock (
IN UINTN Pages IN UINTN Pages
) )
{ {
UFS_PEIM_MEM_BLOCK *Block; UFS_PEIM_MEM_BLOCK *Block;
@ -107,8 +108,8 @@ UfsPeimFreeMemBlock (
**/ **/
VOID * VOID *
UfsPeimAllocMemFromBlock ( UfsPeimAllocMemFromBlock (
IN UFS_PEIM_MEM_BLOCK *Block, IN UFS_PEIM_MEM_BLOCK *Block,
IN UINTN Units IN UINTN Units
) )
{ {
UINTN Byte; UINTN Byte;
@ -221,7 +222,7 @@ UfsPeimIsMemBlockEmpty (
**/ **/
EFI_STATUS EFI_STATUS
UfsPeimInitMemPool ( UfsPeimInitMemPool (
IN UFS_PEIM_HC_PRIVATE_DATA *Private IN UFS_PEIM_HC_PRIVATE_DATA *Private
) )
{ {
UFS_PEIM_MEM_POOL *Pool; UFS_PEIM_MEM_POOL *Pool;
@ -292,8 +293,8 @@ UfsPeimFreeMemPool (
**/ **/
VOID * VOID *
UfsPeimAllocateMem ( UfsPeimAllocateMem (
IN UFS_PEIM_MEM_POOL *Pool, IN UFS_PEIM_MEM_POOL *Pool,
IN UINTN Size IN UINTN Size
) )
{ {
UFS_PEIM_MEM_BLOCK *Head; UFS_PEIM_MEM_BLOCK *Head;
@ -414,6 +415,10 @@ UfsPeimFreeMem (
// //
ASSERT (Block != NULL); ASSERT (Block != NULL);
if (Block == NULL) {
return;
}
// //
// Release the current memory block if it is empty and not the head // Release the current memory block if it is empty and not the head
// //