From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0049.outbound.protection.outlook.com [104.47.0.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1CE3D21959CA4 for ; Tue, 6 Jun 2017 22:03:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=fRQz5YansJQDo2QWgHvOBeZnjNE4TxIBNQGP3S8ZRgs=; b=bgpWerv9EAyYdE+Rw3/DPlzYKaB91aXZEY9WNVPd6kiitUSWS4jOZ4uLFIX/BNVfnvKt1IcaIAiDZBnmkQQkqNQBNcS7JWYILINIHQPkPEBCY+WASkdGA3z6VqUGU2itMI4xZmMy4z6DE70Vtwi0jzmDYSPaHhaJiYWiT+uuQPw= Received: from AM2PR04MB0756.eurprd04.prod.outlook.com (10.160.56.144) by AM2PR04MB0756.eurprd04.prod.outlook.com (10.160.56.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1143.10; Wed, 7 Jun 2017 05:04:36 +0000 Received: from AM2PR04MB0756.eurprd04.prod.outlook.com ([fe80::3ca8:a67f:90c4:a4cc]) by AM2PR04MB0756.eurprd04.prod.outlook.com ([fe80::3ca8:a67f:90c4:a4cc%14]) with mapi id 15.01.1143.019; Wed, 7 Jun 2017 05:04:36 +0000 From: Udit Kumar To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Yao, Jiewen" Thread-Topic: [edk2] [PATCH] MdePkg SmmIoLib: Use NULL pointer check instead of useless Status check Thread-Index: AQHS3cbDh/Gkt5Wc6Euc0WRPKmNFcKIXrh9ggADsFwCAADyggA== Date: Wed, 7 Jun 2017 05:04:36 +0000 Message-ID: References: <1496644870-31620-1-git-send-email-star.zeng@intel.com> <0C09AFA07DD0434D9E2A0C6AEB0483103B8E4165@shsmsx102.ccr.corp.intel.com> In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103B8E4165@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=nxp.com; x-originating-ip: [192.88.169.1] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM2PR04MB0756; 7:FeD4BAuIokUAqWYkMT1sA2JDcVEK7qPXcD87W6VxbhWfRFuZkDgWK5BQjY3+iVDFx7kz+Vi+SzZIqE8P8IT+ZvsvRnMJ/46hkr0zeKbDMSHZ4QcQkmdICt4xdPB/AJB3gayO4nlcbqkV2zYX+AvC4itT7S11ECh3kSljBrYfOAAvliRsmE5SCbqTOc3QjVKLbkaU9vFCreZTuU9GuiWaPNRR8BDVQRgmX+ZBr2MrBqacizVUeh8jDwiFxKFczTWHWDlbs9bW5+btunfzuC3MvDCA59hy+WUSCAc5TYIKPJFGddnnaBP5CH67PKI8EbtCDF80MusoFJR2JIHnXOnk2Q== x-ms-traffictypediagnostic: AM2PR04MB0756: x-ms-office365-filtering-correlation-id: 31d0e72a-9b9f-4f8d-3da3-08d4ad62b1c3 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081)(201702281549075); SRVR:AM2PR04MB0756; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197)(162533806227266)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041248)(20161123562025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123558100)(20161123555025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM2PR04MB0756; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM2PR04MB0756; x-forefront-prvs: 03319F6FEF x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6029001)(6009001)(39850400002)(39410400002)(39450400003)(39840400002)(39860400002)(39400400002)(377454003)(13464003)(54356999)(76176999)(81166006)(6116002)(2950100002)(8676002)(478600001)(14454004)(575784001)(2900100001)(7696004)(966005)(86362001)(53936002)(2501003)(33656002)(74316002)(305945005)(3846002)(55016002)(99286003)(50986999)(4326008)(7736002)(9686003)(6306002)(6506006)(38730400002)(189998001)(8936002)(66066001)(6436002)(5660300001)(25786009)(53546009)(6246003)(5250100002)(229853002)(3280700002)(3660700001)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM2PR04MB0756; H:AM2PR04MB0756.eurprd04.prod.outlook.com; FPR:; SPF:None; MLV:sfv; LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jun 2017 05:04:36.5751 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM2PR04MB0756 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 05:03:31 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Star I restricted myself into debug mode only , while looking at patch . Regards Udit > -----Original Message----- > From: Zeng, Star [mailto:star.zeng@intel.com] > Sent: Wednesday, June 07, 2017 6:41 AM > To: Udit Kumar ; edk2-devel@lists.01.org > Cc: Yao, Jiewen ; Zeng, Star > Subject: RE: [edk2] [PATCH] MdePkg SmmIoLib: Use NULL pointer check inste= ad > of useless Status check >=20 > Hi Udit, >=20 > What does "If mSmmIoLibGcdMemSpace is NULL then if condition is not > reachable." mean? >=20 > ASSERT_EFI_ERROR macro only effects at DEBUG mode, and the if condition i= s > for error handling. >=20 >=20 > Thanks, > Star > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ud= it > 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 inste= ad > of useless Status check >=20 > Hi Star >=20 > > -----Original Message----- > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > > 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 > > instead of useless Status check > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D587 > > > > 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 w= hich > > 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 installe= d. > > > > - @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 =3D AllocateCopyPool (NumberOfDescriptors * > > sizeof (EFI_GCD_MEMORY_SPACE_DESCRIPTOR), MemSpaceMap); > > - ASSERT_EFI_ERROR (Status); > > - if (EFI_ERROR (Status)) { > > + ASSERT (mSmmIoLibGcdMemSpace !=3D NULL); > > + if (mSmmIoLibGcdMemSpace =3D=3D NULL) { >=20 >=20 > If mSmmIoLibGcdMemSpace is NULL then if condition is not reachable. > If not NULL then if condition will be false always, I think if condition = is not > needed. >=20 >=20 > > gBS->FreePool (MemSpaceMap); > > - return Status; > > + return EFI_OUT_OF_RESOURCES; > > } > > > > mSmmIoLibGcdMemNumberOfDesc =3D NumberOfDescriptors; > > -- > > 2.7.0.windows.1 >=20 >=20 > Regards > Udit >=20 > > _______________________________________________ > > 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