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 61C4A21A07A94 for ; Mon, 19 Jun 2017 07:40:48 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jun 2017 07:41:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,361,1493708400"; d="scan'208";a="1142741437" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga001.jf.intel.com with ESMTP; 19 Jun 2017 07:41:55 -0700 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 19 Jun 2017 07:41:55 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 19 Jun 2017 07:41:54 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.146]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.56]) with mapi id 14.03.0319.002; Mon, 19 Jun 2017 22:41:51 +0800 From: "Gao, Liming" To: Amit Kumar , "edk2-devel@lists.01.org" CC: "Tian, Feng" Thread-Topic: [edk2] [PATCH V3] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol Thread-Index: AQHS6PbUrjrwdBr8T0SzQAitodgc+qIsQmrg Date: Mon, 19 Jun 2017 14:41:50 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D74BE5B@shsmsx102.ccr.corp.intel.com> References: <7741fb0a1a1c12f94eb6756745bc39a9bcc58135.1497874973.git.amit.ak@samsung.com> In-Reply-To: <7741fb0a1a1c12f94eb6756745bc39a9bcc58135.1497874973.git.amit.ak@samsung.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH V3] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol 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, 19 Jun 2017 14:40:48 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Am= it Kumar > Sent: Monday, June 19, 2017 8:24 PM > To: edk2-devel@lists.01.org > Cc: Tian, Feng > Subject: [edk2] [PATCH V3] MdeModulePkg/DxeCore: Fixed Interface returned= by CoreOpenProtocol >=20 > Change Since v2: > 1) Modified to use EFI_ERROR to get status code >=20 > Change since v1: > 1) Fixed typo protocal to protocol > 2) Fixed coding style >=20 > Modified source code to update Interface as per spec. > 1) In case of Protocol is un-supported, interface should be returned NULL= . > 2) In case of any error, interface should not be modified. > 3) In case of Test Protocol, interface is optional. >=20 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Amit Kumar > --- > MdeModulePkg/Core/Dxe/Hand/Handle.c | 24 ++++++++++++------------ > 1 file changed, 12 insertions(+), 12 deletions(-) >=20 > diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/= Hand/Handle.c > index 1c25521..6de300f 100644 > --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c > +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c > @@ -1004,12 +1004,8 @@ CoreOpenProtocol ( > // > // Check for invalid Interface > // > - if (Attributes !=3D EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { > - if (Interface =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } else { > - *Interface =3D NULL; > - } > + if ((Attributes !=3D EFI_OPEN_PROTOCOL_TEST_PROTOCOL) && (Interface = =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > } >=20 > // > @@ -1073,15 +1069,11 @@ CoreOpenProtocol ( > Prot =3D CoreGetProtocolInterface (UserHandle, Protocol); > if (Prot =3D=3D NULL) { > Status =3D EFI_UNSUPPORTED; > + // Return NULL Interface if Unsupported Protocol > + *Interface =3D NULL; > goto Done; > } >=20 > - // > - // This is the protocol interface entry for this protocol > - // > - if (Attributes !=3D EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { > - *Interface =3D Prot->Interface; > - } > Status =3D EFI_SUCCESS; >=20 > ByDriver =3D FALSE; > @@ -1175,6 +1167,14 @@ CoreOpenProtocol ( > } >=20 > Done: > + > + // > + // This is the protocol interface entry for this protocol. > + // In case of any Error, Interface should not be updated as per spec. > + // > + if (!EFI_ERROR (Status) && Attributes !=3D EFI_OPEN_PROTOCOL_TEST_PROT= OCOL) { > + *Interface =3D Prot->Interface; > + } > // > // Done. Release the database lock are return > // > -- > 1.9.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel