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

@@ -1,6 +1,7 @@
/** @file
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
@@ -18,7 +19,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
UFS_PEIM_MEM_BLOCK *
UfsPeimAllocMemBlock (
IN UINTN Pages
IN UINTN Pages
)
{
UFS_PEIM_MEM_BLOCK *Block;
@@ -107,8 +108,8 @@ UfsPeimFreeMemBlock (
**/
VOID *
UfsPeimAllocMemFromBlock (
IN UFS_PEIM_MEM_BLOCK *Block,
IN UINTN Units
IN UFS_PEIM_MEM_BLOCK *Block,
IN UINTN Units
)
{
UINTN Byte;
@@ -221,7 +222,7 @@ UfsPeimIsMemBlockEmpty (
**/
EFI_STATUS
UfsPeimInitMemPool (
IN UFS_PEIM_HC_PRIVATE_DATA *Private
IN UFS_PEIM_HC_PRIVATE_DATA *Private
)
{
UFS_PEIM_MEM_POOL *Pool;
@@ -292,8 +293,8 @@ UfsPeimFreeMemPool (
**/
VOID *
UfsPeimAllocateMem (
IN UFS_PEIM_MEM_POOL *Pool,
IN UINTN Size
IN UFS_PEIM_MEM_POOL *Pool,
IN UINTN Size
)
{
UFS_PEIM_MEM_BLOCK *Head;
@@ -414,6 +415,10 @@ UfsPeimFreeMem (
//
ASSERT (Block != NULL);
if (Block == NULL) {
return;
}
//
// Release the current memory block if it is empty and not the head
//