From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 8D0FB21C93EF4 for ; Tue, 6 Jun 2017 18:09:38 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jun 2017 18:10:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,308,1493708400"; d="scan'208";a="96395733" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga002.jf.intel.com with ESMTP; 06 Jun 2017 18:10:45 -0700 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 6 Jun 2017 18:10:45 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 6 Jun 2017 18:10:44 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.146]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.116]) with mapi id 14.03.0319.002; Wed, 7 Jun 2017 09:10:43 +0800 From: "Zeng, Star" To: Udit Kumar , "edk2-devel@lists.01.org" CC: "Yao, Jiewen" , "Zeng, Star" Thread-Topic: [edk2] [PATCH] MdePkg SmmIoLib: Use NULL pointer check instead of useless Status check Thread-Index: AQHS3cbK9M3tu81SQUme2VP7RMJ7NqIXKXiAgAFt0KA= Date: Wed, 7 Jun 2017 01:10:42 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B8E4165@shsmsx102.ccr.corp.intel.com> References: <1496644870-31620-1-git-send-email-star.zeng@intel.com> In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: Wed, 07 Jun 2017 01:09:38 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Udit, What does "If mSmmIoLibGcdMemSpace is NULL then if condition is not reachab= le." mean? ASSERT_EFI_ERROR macro only effects at DEBUG mode, and the if condition is = for error handling. Thanks, Star -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Udit= Kumar Sent: Tuesday, June 6, 2017 7:11 PM To: Zeng, Star ; edk2-devel@lists.01.org Cc: Yao, Jiewen Subject: Re: [edk2] [PATCH] MdePkg SmmIoLib: Use NULL pointer check instead= of useless Status check Hi Star=20 > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of=20 > Star Zeng > Sent: Monday, June 05, 2017 12:11 PM > To: edk2-devel@lists.01.org > Cc: Jiewen Yao ; Star Zeng > Subject: [edk2] [PATCH] MdePkg SmmIoLib: Use NULL pointer check=20 > instead of useless Status check >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D587 >=20 > The Status check in "if (!EFI_ERROR (Status))" condition is useless,=20 > it should be NULL pointer check. And this patch also fixes a typo=20 > "continous" to "continuous". >=20 > 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(-) >=20 > 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 ( > } >=20 > /** > - Merge continous entries whose type is EfiGcdMemoryTypeMemoryMappedIo. > + Merge continuous entries whose type is > EfiGcdMemoryTypeMemoryMappedIo. >=20 > @param[in, out] GcdMemoryMap A pointer to the buffer in whi= ch > 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. >=20 > - @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); >=20 > mSmmIoLibGcdMemSpace =3D AllocateCopyPool (NumberOfDescriptors *=20 > sizeof (EFI_GCD_MEMORY_SPACE_DESCRIPTOR), MemSpaceMap); > - ASSERT_EFI_ERROR (Status); > - if (EFI_ERROR (Status)) { > + ASSERT (mSmmIoLibGcdMemSpace !=3D NULL); > + if (mSmmIoLibGcdMemSpace =3D=3D NULL) { If mSmmIoLibGcdMemSpace is NULL then if condition is not reachable.=20 If not NULL then if condition will be false always, I think if condition is= not needed. =20 > gBS->FreePool (MemSpaceMap); > - return Status; > + return EFI_OUT_OF_RESOURCES; > } >=20 > mSmmIoLibGcdMemNumberOfDesc =3D NumberOfDescriptors; > -- > 2.7.0.windows.1 Regards Udit > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel