From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4F71521A16E4A for ; Sun, 4 Jun 2017 23:40:16 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jun 2017 23:41:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,299,1493708400"; d="scan'208";a="110913822" Received: from shwdeopenpsi068.ccr.corp.intel.com ([10.239.9.15]) by fmsmga006.fm.intel.com with ESMTP; 04 Jun 2017 23:41:20 -0700 From: Star Zeng To: edk2-devel@lists.01.org Cc: Star Zeng , Jiewen Yao Date: Mon, 5 Jun 2017 14:41:10 +0800 Message-Id: <1496644870-31620-1-git-send-email-star.zeng@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 Subject: [PATCH] MdePkg SmmIoLib: Use NULL pointer check instead of useless Status check X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jun 2017 06:40:16 -0000 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=587 The Status check in "if (!EFI_ERROR (Status))" condition is useless, it should be NULL pointer check. And this patch also fixes a typo "continous" to "continuous". Cc: Jiewen Yao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng --- MdePkg/Library/SmmIoLib/SmmIoLib.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/MdePkg/Library/SmmIoLib/SmmIoLib.c b/MdePkg/Library/SmmIoLib/SmmIoLib.c index 181abb8e25df..f1cb0dace500 100644 --- a/MdePkg/Library/SmmIoLib/SmmIoLib.c +++ b/MdePkg/Library/SmmIoLib/SmmIoLib.c @@ -156,7 +156,7 @@ SmmIsMmioValid ( } /** - Merge continous entries whose type is EfiGcdMemoryTypeMemoryMappedIo. + Merge continuous entries whose type is EfiGcdMemoryTypeMemoryMappedIo. @param[in, out] GcdMemoryMap A pointer to the buffer in which firmware places the current GCD memory map. @@ -217,7 +217,8 @@ MergeGcdMmioEntry ( @param[in] Interface Points to the interface instance. @param[in] Handle The handle on which the interface was installed. - @retval EFI_SUCCESS Notification runs successfully. + @retval EFI_SUCCESS Notification runs successfully. + @retval EFI_OUT_OF_RESOURCES No enough resources to save GCD MMIO map. **/ EFI_STATUS EFIAPI @@ -237,10 +238,10 @@ SmmIoLibInternalEndOfDxeNotify ( MergeGcdMmioEntry (MemSpaceMap, &NumberOfDescriptors); mSmmIoLibGcdMemSpace = AllocateCopyPool (NumberOfDescriptors * sizeof (EFI_GCD_MEMORY_SPACE_DESCRIPTOR), MemSpaceMap); - ASSERT_EFI_ERROR (Status); - if (EFI_ERROR (Status)) { + ASSERT (mSmmIoLibGcdMemSpace != NULL); + if (mSmmIoLibGcdMemSpace == NULL) { gBS->FreePool (MemSpaceMap); - return Status; + return EFI_OUT_OF_RESOURCES; } mSmmIoLibGcdMemNumberOfDesc = NumberOfDescriptors; -- 2.7.0.windows.1