From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20045.outbound.protection.outlook.com [40.107.2.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C76DC21A0910B for ; Tue, 6 Jun 2017 04:09:51 -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=ZiOHjW0GYjT+a82G6QEDNNpjV980VG5GM2/pdG591G4=; b=RFH52/1ZIVLZIZOVJxt9b/KXO1aGOEvXym/24Fx9/9tyB/iE4bHkW4qz8oT1epKg8HHJ+rbQdD/s8dtvW5XP3U8Xk/JGUY8aDJqxfwhT7Q/qlgr9yQenO2yxmUE40rCBA4CP+In0Me+34EHfPvFC2joXcArw2jmrcptWkfxXZXM= Received: from AM2PR04MB0756.eurprd04.prod.outlook.com (10.160.56.144) by AM2PR04MB0755.eurprd04.prod.outlook.com (10.160.56.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1143.10; Tue, 6 Jun 2017 11:10:56 +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.018; Tue, 6 Jun 2017 11:10:56 +0000 From: Udit Kumar To: Star Zeng , "edk2-devel@lists.01.org" CC: Jiewen Yao Thread-Topic: [edk2] [PATCH] MdePkg SmmIoLib: Use NULL pointer check instead of useless Status check Thread-Index: AQHS3cbDh/Gkt5Wc6Euc0WRPKmNFcKIXrh9g Date: Tue, 6 Jun 2017 11:10:55 +0000 Message-ID: References: <1496644870-31620-1-git-send-email-star.zeng@intel.com> In-Reply-To: <1496644870-31620-1-git-send-email-star.zeng@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; AM2PR04MB0755; 7:5BvtpnikdQEDE+uKR3nEBSwFDUtVfV4f84/0JINnAodIKgU2ZJMJ6IaRejw430TK2HDCjbG9FB95FYa+UNolWkOYSpVCLhmLN93ib5PPAJIq5VxXay8nYoY5oQaf3AwTptI2Ao/yE6h5lbWzqwVjzR6csMHWLUeo+9nwfhtjffv0F9U8MJmx9244IF7F480JK3ztMRj+Y/wTiICJB3V4J11l1DPkenyCyygrHuerpuOI6gELYTIvDOLNZ3MOlFl7vWY+2nKpIKiF0sLRc/mmbTw5bCbQX08tigMeBvVeHGRLmhuE2UfDK6yp0rhleRMt0C3yjM1YTbj2PNRJ2XPwnw== x-ms-traffictypediagnostic: AM2PR04MB0755: x-ms-office365-filtering-correlation-id: 82fab0bc-3e4c-46f3-3456-08d4acccb41c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081); SRVR:AM2PR04MB0755; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(162533806227266)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(100000703101)(100105400095)(3002001)(93006095)(93001095)(6055026)(6041248)(20161123564025)(20161123560025)(20161123555025)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM2PR04MB0755; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM2PR04MB0755; x-forefront-prvs: 033054F29A x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(6029001)(39410400002)(39400400002)(39850400002)(39840400002)(39450400003)(39860400002)(377454003)(5660300001)(86362001)(8936002)(81166006)(3660700001)(8676002)(74316002)(2950100002)(305945005)(3280700002)(3846002)(102836003)(966005)(229853002)(25786009)(4326008)(7736002)(189998001)(6116002)(54356999)(575784001)(33656002)(6506006)(76176999)(7696004)(2906002)(14454004)(53546009)(38730400002)(66066001)(99286003)(50986999)(478600001)(53936002)(6246003)(2900100001)(6306002)(6436002)(5250100002)(9686003)(2501003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM2PR04MB0755; 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: 06 Jun 2017 11:10:55.9729 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM2PR04MB0755 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: Tue, 06 Jun 2017 11:09:52 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Star=20 > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of St= ar > 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 o= f > 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, it s= hould be > NULL pointer check. And this patch also fixes a typo "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 * > 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,=20 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