From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 E22948196F for ; Tue, 10 Jan 2017 08:20:56 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 10 Jan 2017 08:20:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,344,1477983600"; d="scan'208";a="28602026" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga002.jf.intel.com with ESMTP; 10 Jan 2017 08:20:56 -0800 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 10 Jan 2017 08:20:56 -0800 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.47]) by fmsmsx118.amr.corp.intel.com ([169.254.1.242]) with mapi id 14.03.0248.002; Tue, 10 Jan 2017 08:20:55 -0800 From: "Carsey, Jaben" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" CC: "Chen, Chen A" , "Carsey, Jaben" Thread-Topic: [PATCH 4/5] ShellPkg/Dh: Fix coding style issues Thread-Index: AQHSalsdlef3BkcunE6izesxtJuTbKEwRnAQgAE8UwCAAGOCYA== Date: Tue, 10 Jan 2017 16:20:55 +0000 Message-ID: References: <20170109093052.140504-1-ruiyu.ni@intel.com> <20170109093052.140504-5-ruiyu.ni@intel.com> <734D49CCEBEEF84792F5B80ED585239D5B8799B9@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5B8799B9@SHSMSX104.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOTRlYjIwZmMtNGNlYy00ZGJkLTg1NjctNWY3NjMxZmYwYzE4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IjFPaWZ2N3RNZzczWkdpeGIyUnRUNjZxR0lxeXNYelBTSzFwSVJrNkE0Mk09In0= x-ctpclassification: CTP_IC x-originating-ip: [10.1.200.108] MIME-Version: 1.0 Subject: Re: [PATCH 4/5] ShellPkg/Dh: Fix coding style issues X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2017 16:20:57 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Oh. Reviewed-by: Jaben Carsey > -----Original Message----- > From: Ni, Ruiyu > Sent: Monday, January 09, 2017 6:25 PM > To: Carsey, Jaben ; edk2-devel@lists.01.org > Cc: Chen, Chen A > Subject: RE: [PATCH 4/5] ShellPkg/Dh: Fix coding style issues > Importance: High >=20 > DisplayDriverModelHandle() always return SUCCESS so we change the return > type to VOID. >=20 > Thanks/Ray >=20 > > -----Original Message----- > > From: Carsey, Jaben > > Sent: Monday, January 9, 2017 11:37 PM > > To: Ni, Ruiyu ; edk2-devel@lists.01.org > > Cc: Chen, Chen A ; Carsey, Jaben > > > > Subject: RE: [PATCH 4/5] ShellPkg/Dh: Fix coding style issues > > > > One question inline. > > > > > -----Original Message----- > > > From: Ni, Ruiyu > > > Sent: Monday, January 9, 2017 1:31 AM > > > To: edk2-devel@lists.01.org > > > Cc: Chen, Chen A ; Carsey, Jaben > > > > > > Subject: [PATCH 4/5] ShellPkg/Dh: Fix coding style issues > > > Importance: High > > > > > > From: Chen A Chen > > > > > > The change doesn't impact the functionality. > > > > > > Contributed-under: TianoCore Contribution Agreement 1.0 > > > Cc: Jaben Carsey > > > Cc: Ruiyu Ni > > > Signed-off-by: Ruiyu Ni > > > Signed-off-by: Chen A Chen > > > --- > > > ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c | 119 > > > ++++++++++---------- > > > -- > > > 1 file changed, 54 insertions(+), 65 deletions(-) > > > > > > diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c > > > b/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c > > > index 0ac49e1..2773842 100644 > > > --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c > > > +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c > > > @@ -642,11 +642,8 @@ DisplayDriverModelHandle ( > > > @param[in] DriverInfo TRUE to show all info about the handle= . > > > @param[in] Multiple TRUE indicates more than will be outp= ut, > > > FALSE for a single one. > > > - > > > - @retval SHELL_SUCCESS The operation was successful. > > > - @retval SHELL_INVALID_PARAMETER ProtocolName was NULL or > invalid. > > > **/ > > > -SHELL_STATUS > > > +VOID > > > > Is there a reason to change the function to VOID and not add a check fo= r > the > > return from the DisplayDriverModelHandle function? > > > > > DoDhByHandle( > > > IN CONST EFI_HANDLE TheHandle, > > > IN CONST BOOLEAN Verbose, > > > @@ -656,10 +653,8 @@ DoDhByHandle( > > > IN CONST BOOLEAN Multiple > > > ) > > > { > > > - CHAR16 *ProtocolInfoString; > > > - SHELL_STATUS ShellStatus; > > > + CHAR16 *ProtocolInfoString; > > > > > > - ShellStatus =3D SHELL_SUCCESS; > > > ProtocolInfoString =3D NULL; > > > > > > if (!Sfo) { > > > @@ -672,7 +667,8 @@ DoDhByHandle( > > > STRING_TOKEN (STR_DH_OUTPUT), > > > gShellDriver1HiiHandle, > > > ConvertHandleToHandleIndex(TheHandle), > > > - ProtocolInfoString=3D=3DNULL?L"":ProtocolInfoString); > > > + ProtocolInfoString=3D=3DNULL?L"":ProtocolInfoString > > > + ); > > > } else { > > > ProtocolInfoString =3D GetProtocolInfoString(TheHandle, Langua= ge, > > > L"\r\n", Verbose, TRUE); > > > ShellPrintHiiEx( > > > @@ -683,7 +679,8 @@ DoDhByHandle( > > > gShellDriver1HiiHandle, > > > ConvertHandleToHandleIndex(TheHandle), > > > TheHandle, > > > - ProtocolInfoString=3D=3DNULL?L"":ProtocolInfoString); > > > + ProtocolInfoString=3D=3DNULL?L"":ProtocolInfoString > > > + ); > > > } > > > > > > if (DriverInfo) { > > > @@ -702,16 +699,13 @@ DoDhByHandle( > > > L"ControllerName", > > > ConvertHandleToHandleIndex(TheHandle), > > > L"DevPath", > > > - ProtocolInfoString=3D=3DNULL?L"":ProtocolInfoString); > > > - > > > - > > > + ProtocolInfoString=3D=3DNULL?L"":ProtocolInfoString > > > + ); > > > } > > > > > > - > > > if (ProtocolInfoString !=3D NULL) { > > > FreePool(ProtocolInfoString); > > > } > > > - return (ShellStatus); > > > } > > > > > > /** > > > @@ -723,8 +717,8 @@ DoDhByHandle( > > > @param[in] Language Language string per UEFI specification= . > > > @param[in] DriverInfo TRUE to show all info about the handle= . > > > > > > - @retval SHELL_SUCCESS The operation was successful. > > > - @retval SHELL_INVALID_PARAMETER ProtocolName was NULL or > invalid. > > > + @retval SHELL_SUCCESS The operation was successful. > > > + @retval SHELL_ABORTED The operation was aborted. > > > **/ > > > SHELL_STATUS > > > DoDhForHandleList( > > > @@ -740,15 +734,8 @@ DoDhForHandleList( > > > > > > ShellStatus =3D SHELL_SUCCESS; > > > > > > - for (HandleWalker =3D HandleList ; HandleWalker !=3D NULL && > > > *HandleWalker !=3D NULL && ShellStatus =3D=3D SHELL_SUCCESS; > > HandleWalker++) { > > > - ShellStatus =3D DoDhByHandle( > > > - *HandleWalker, > > > - Verbose, > > > - Sfo, > > > - Language, > > > - DriverInfo, > > > - TRUE > > > - ); > > > + for ( HandleWalker =3D HandleList; HandleWalker !=3D NULL && > > > + *HandleWalker !=3D > > > NULL; HandleWalker++ ) { > > > + DoDhByHandle (*HandleWalker, Verbose, Sfo, Language, DriverInfo, > > > + TRUE); > > > if (ShellGetExecutionBreakFlag ()) { > > > ShellStatus =3D SHELL_ABORTED; > > > break; > > > @@ -862,10 +849,10 @@ ShellCommandRunDh ( > > > SHELL_STATUS ShellStatus; > > > CHAR8 *Language; > > > CONST CHAR16 *Lang; > > > - CONST CHAR16 *Temp2; > > > - BOOLEAN SfoMode; > > > - BOOLEAN FlagD; > > > - BOOLEAN Verbose; > > > + CONST CHAR16 *RawValue; > > > + BOOLEAN SfoFlag; > > > + BOOLEAN DriverFlag; > > > + BOOLEAN VerboseFlag; > > > UINT64 Intermediate; > > > > > > ShellStatus =3D SHELL_SUCCESS; > > > @@ -900,30 +887,32 @@ ShellCommandRunDh ( > > > return (SHELL_INVALID_PARAMETER); > > > } > > > > > > - Lang =3D ShellCommandLineGetValue(Package, L"-l"); > > > - if (Lang !=3D NULL) { > > > - Language =3D AllocateZeroPool(StrSize(Lang)); > > > - AsciiSPrint(Language, StrSize(Lang), "%S", Lang); > > > - } else if (!ShellCommandLineGetFlag(Package, L"-l")){ > > > + if (ShellCommandLineGetFlag(Package, L"-l")) { > > > + Lang =3D ShellCommandLineGetValue(Package, L"-l"); > > > + if (Lang !=3D NULL) { > > > + Language =3D AllocateZeroPool(StrSize(Lang)); > > > + AsciiSPrint(Language, StrSize(Lang), "%S", Lang); > > > + } else { > > > + ASSERT(Language =3D=3D NULL); > > > + ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_GEN_NO_VALUE)= , > > > gShellDriver1HiiHandle, L"dh", L"-l"); > > > + ShellCommandLineFreeVarList(Package); > > > + return (SHELL_INVALID_PARAMETER); > > > + } > > > + } else { > > > Language =3D AllocateZeroPool(10); > > > AsciiSPrint(Language, 10, "en-us"); > > > - } else { > > > - ASSERT(Language =3D=3D NULL); > > > - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), > > > gShellDriver1HiiHandle, L"dh", L"-l"); > > > - ShellCommandLineFreeVarList (Package); > > > - return (SHELL_INVALID_PARAMETER); > > > } > > > > > > - SfoMode =3D ShellCommandLineGetFlag(Package, L"-sfo"); > > > - FlagD =3D ShellCommandLineGetFlag(Package, L"-d"); > > > - Verbose =3D (BOOLEAN)(ShellCommandLineGetFlag(Package, L"-v") || > > > ShellCommandLineGetFlag(Package, L"-verbose")); > > > + SfoFlag =3D ShellCommandLineGetFlag (Package, L"-sfo"); > > > + DriverFlag =3D ShellCommandLineGetFlag (Package, L"-d"); > > > + VerboseFlag =3D (BOOLEAN)(ShellCommandLineGetFlag (Package, L"- > v") > > > + || > > > ShellCommandLineGetFlag (Package, L"-verbose")); > > > > > > - if (ShellCommandLineGetFlag(Package, L"-p")) { > > > - if (ShellCommandLineGetCount(Package) > 1) { > > > - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN > (STR_GEN_TOO_MANY), > > > gShellDriver1HiiHandle, L"dh"); > > > + if (ShellCommandLineGetFlag (Package, L"-p")) { > > > + if (ShellCommandLineGetCount (Package) > 1) { > > > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > > > + (STR_GEN_TOO_MANY), > > > gShellDriver1HiiHandle, L"dh"); > > > ShellStatus =3D SHELL_INVALID_PARAMETER; > > > } else if (ShellCommandLineGetValue(Package, L"-p") =3D=3D NUL= L) { > > > - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE= ), > > > gShellDriver1HiiHandle, L"dh", L"-p"); > > > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > > > + (STR_GEN_NO_VALUE), > > > gShellDriver1HiiHandle, L"dh", L"-p"); > > > ShellStatus =3D SHELL_INVALID_PARAMETER; > > > } else { > > > // > > > @@ -931,41 +920,41 @@ ShellCommandRunDh ( > > > // > > > ShellStatus =3D DoDhByProtocol( > > > ShellCommandLineGetValue(Package, L"-p"), > > > - Verbose, > > > - SfoMode, > > > - Lang=3D=3DNULL?NULL:Language, > > > - FlagD > > > - ); > > > + VerboseFlag, > > > + SfoFlag, > > > + Language, > > > + DriverFlag > > > + ); > > > } > > > } else { > > > - Temp2 =3D ShellCommandLineGetRawValue(Package, 1); > > > - if (Temp2 =3D=3D NULL) { > > > + RawValue =3D ShellCommandLineGetRawValue(Package, 1); > > > + if (RawValue =3D=3D NULL) { > > > // > > > // Print everything > > > // > > > ShellStatus =3D DoDhForAll( > > > - SfoMode, > > > - Verbose, > > > - Lang=3D=3DNULL?NULL:Language, > > > - FlagD > > > + SfoFlag, > > > + VerboseFlag, > > > + Language, > > > + DriverFlag > > > ); > > > } else { > > > - Status =3D ShellConvertStringToUint64(Temp2, &Intermediate, = TRUE, > > FALSE); > > > + Status =3D ShellConvertStringToUint64(RawValue, &Intermediat= e, > > > + TRUE, > > > FALSE); > > > if (EFI_ERROR(Status) || > > > ConvertHandleIndexToHandle((UINTN)Intermediate) =3D=3D NULL) { > > > - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN > (STR_GEN_INV_HANDLE), > > > gShellDriver1HiiHandle, L"dh", Temp2); > > > + ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN > > > + (STR_GEN_INV_HANDLE), > > > gShellDriver1HiiHandle, L"dh", RawValue); > > > ShellStatus =3D SHELL_INVALID_PARAMETER; > > > } else { > > > // > > > // print 1 handle > > > // > > > - ShellStatus =3D DoDhByHandle( > > > + DoDhByHandle( > > > ConvertHandleIndexToHandle((UINTN)Intermediate), > > > - Verbose, > > > - SfoMode, > > > - Lang=3D=3DNULL?NULL:Language, > > > - FlagD, > > > + VerboseFlag, > > > + SfoFlag, > > > + Language, > > > + DriverFlag, > > > FALSE > > > - ); > > > + ); > > > } > > > } > > > } > > > -- > > > 2.9.0.windows.1