From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 56A7B740034 for ; Wed, 13 Dec 2023 12:14:12 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Vil8qWqE3v6pseeLDEaecT0GhzvlCFY/uSz3x3GAsiI=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Received-SPF:ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:Authentication-Results-Original:nodisclaimer:MIME-Version:Original-Authentication-Results:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-ID:Content-Transfer-Encoding; s=20140610; t=1702469650; v=1; b=CAnkjh44MIVMuFPpAW4i677qWsehDqaU0x+bhEJdVd8E63txoF555cjIFPnxF5rrotV6Kh6D 8FTDd6b2hTcm6Ajs9GMqbD2tzUYiLD6i8HopQ5jsk6bIWo1uwZPNPVqsFjTkN8EfNDvCQWFf+CI AXSamcVDEKNT9J460Bh9lX4s= X-Received: by 127.0.0.2 with SMTP id HYzUYY7687511xt1MNvXCHX7; Wed, 13 Dec 2023 04:14:10 -0800 X-Received: from EUR05-DB8-obe.outbound.protection.outlook.com (EUR05-DB8-obe.outbound.protection.outlook.com [40.107.20.83]) by mx.groups.io with SMTP id smtpd.web10.34334.1702467941581310880 for ; Wed, 13 Dec 2023 03:45:42 -0800 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=QsSMyoqz39Vt/Fa6hC8cVfBrSI+RYjzIIGLwV/BZz/Se1iYVerYtfKOQGaenDkD9hjcIBLL6/XH5/zpMt7nO/bR/xy+HTJq5gDFtqQwIvhhf7wm7GqeaDZx+HHrRDsJwAS3jwfTybpY7WN1kw0YS2ipik5PoQK62ERRt9BMD+ELl5/K/oWHGC4mFm/J0IV4VjPjmtJk0Ap3270aCcNnpf/9Or2QRZ6vgcufA0keORDaiOKs+AivIb8wSt2gpmHXcwcccYKo/PFZut9w6kJD2z1bfvcCblxo4lH6YJfhR198mVHLElxFufXUdcHP69BhQtk1yt/v6bxjPpdlL0tyhqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=d4Hhjgg+yGzPUVEsQVesxf7/DmRaWA8kbjWyWGcGvSc=; b=kIJ7BSdZaei7zXzBIHhq8IdBUxnNY2juTN2m/RqDlsqswH9SxofKWlrDhzKLy6CN5ETvqXijp6EfyIcnBT++FH9tgRM/5P7V7RfcGYBd9CZnfcWF3dlquL+licvizBmgfqsoZQg8YheOo48VcIe37quZk5toh4Z4RcWsPSc0Xw1ZatFA+UKJ55cFc6/LpGEENQgt9+65m66Xw/hLz6lUoi/WcWjA/iwE/2lj4xGrmVCAPA/q9rG+5D1IHtz3Xf9YZV1C28KO6etN8L1FOSmFIy5UK9+Gz0oFBuLwopdEMt33Sn1A35JQP7wzUuiGVnVRRjr5ahc1fMOHn7hDfCr4qQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) X-Received: from AS9PR05CA0114.eurprd05.prod.outlook.com (2603:10a6:20b:498::16) by PA4PR08MB6079.eurprd08.prod.outlook.com (2603:10a6:102:ee::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.33; Wed, 13 Dec 2023 11:45:38 +0000 X-Received: from AM1PEPF000252DE.eurprd07.prod.outlook.com (2603:10a6:20b:498:cafe::8e) by AS9PR05CA0114.outlook.office365.com (2603:10a6:20b:498::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32 via Frontend Transport; Wed, 13 Dec 2023 11:45:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM1PEPF000252DE.mail.protection.outlook.com (10.167.16.56) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26 via Frontend Transport; Wed, 13 Dec 2023 11:45:37 +0000 X-Received: ("Tessian outbound e243565b0037:v228"); Wed, 13 Dec 2023 11:45:37 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1ad6c16b50148756 X-CR-MTA-TID: 64aa7808 X-Received: from d71cf78cffce.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 63B3742A-AE13-44E4-8A06-7DBE657B56CA.1; Wed, 13 Dec 2023 11:45:26 +0000 X-Received: from EUR02-AM0-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d71cf78cffce.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 13 Dec 2023 11:45:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B93/wSU5rFNGeUkfzmXD9lQHwPK7gpDD8RTLs9Q7D+NcjkKIJ99ZdsYoxgaX8Wa+XV2PPuVtm+T+0C6Lt4lRMBihBTU/g/63W0Zci6q/WshyMfxlGUHQsxzWNVnPfNhbKvw2nRsxLGflTAH4NghgJ4pXyw5K37PfTKyRAAX0zlIKkRAqscZJyPjIp30RlOuTkWek7hR+k35iA3lO4p7UOfWVxo9DDpdn1pVN5NLYG2ncX+XJxEf+ZclOQkRxOgDYCVkAdReJkPk+8KibIxkIBlYselI/6ELInjCbMwVM+Dwv4VjFZbFzE/f4rfCHW702UzmDpFGj15G1BcBbRQV1oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=d4Hhjgg+yGzPUVEsQVesxf7/DmRaWA8kbjWyWGcGvSc=; b=Dff/aScofbnQ9SJXJI4JRyYHRsXVMFtDyvCttwEJh+SL0H2xEr78ULky1c2HJMx66TQyDCZb6W7fEcLeePJyF7L+pzpU57gVuakU9YLNcKDKtXlt0cBViYPpN8CvQJnHMatApucbxpv42fv4kceIWe+Lp/W83DqAASUHR+UJrOkA/5Yz/uLqMlHbvP/O/EficaUohScSflrErSP+6ft357/0XtBLKifJ2NPftbDGjjiOT3W2cyJsUDzBwuKeiprd9EfXpomDp8imRTD7lL4AKv6yAbe66L0T9LEnOZOIk56gKR/NDmBfix6GpYkQfd/QMXvasWrFqtI+l0uDm4TRaA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none X-Received: from AM8PR08MB5665.eurprd08.prod.outlook.com (2603:10a6:20b:1da::21) by PAVPR08MB9458.eurprd08.prod.outlook.com (2603:10a6:102:318::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.33; Wed, 13 Dec 2023 11:45:23 +0000 X-Received: from AM8PR08MB5665.eurprd08.prod.outlook.com ([fe80::bb09:5794:1d17:7e2e]) by AM8PR08MB5665.eurprd08.prod.outlook.com ([fe80::bb09:5794:1d17:7e2e%6]) with mapi id 15.20.7091.022; Wed, 13 Dec 2023 11:45:23 +0000 From: "Tom Pilar" To: "devel@edk2.groups.io" , Daniel Nguyen CC: nd , Zhichao Gao , Ray Ni Subject: Re: [edk2-devel] [PATCH v2 1/1] ShellPkg: Tidy for code readability Thread-Topic: [edk2-devel] [PATCH v2 1/1] ShellPkg: Tidy for code readability Thread-Index: AQHaIvIrhiM66Is6a0ueIXtKMfSiIbCnJpEA Date: Wed, 13 Dec 2023 11:45:23 +0000 Message-ID: <46D1DFA2-3809-489A-8EC5-5D32ED3075A3@arm.com> References: <20231129182840.2333098-1-daniel.nguyen@arm.com> <20231129182840.2333098-2-daniel.nguyen@arm.com> In-Reply-To: <20231129182840.2333098-2-daniel.nguyen@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-traffictypediagnostic: AM8PR08MB5665:EE_|PAVPR08MB9458:EE_|AM1PEPF000252DE:EE_|PA4PR08MB6079:EE_ X-MS-Office365-Filtering-Correlation-Id: eb561ada-6477-44a2-0327-08dbfbd10679 x-checkrecipientrouted: true nodisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 4d9lt62eqKGRC5UGaK3lq86qClUWT+LkIi/qOcvR5uwXjfWLrtE9T5PmDBwonBfXLFtM2maXfHJkpYYu9+EeiqQnjY2UMmExRBho8NSIi5sP3pK77jxQlVd10syYtGCS9TX2LiHemvcMnRwPDE2thkS18kn0XAK78X3GjBXft3Z3oZsC7VoZ9/ZSorzLX8vgb2rgz/uPZTznmmm2gUZZd8rjcKQioJgA8+Wi2iAyFYTk36Ahorg2EUQ/ue5OzJuP2w5OGD/mM2IPHyxlflZRtnLIKJwvuE1RPtO+Fz5vtD5QQof7OYMSVsqJn8NT4DMOWSK9PE1VrUgMLS9NvrDRgSYCN37rBMFGqFga5zcApiEDSZkX61oBHsTGMK5hMzQFLuJsB3kAqOTKeJ8w77v46zvLHnD0yrfA9Z0THMh7GinXzHmRDxpla47R3p7Nx37SFADqWLPJKzFgel1EpDSOcQpLfAIZ6zbvibglScOLBvsPvd0WMEy5L0W7X39z4zqdDG+byyj5gAxzTIqB7kDIlfCJZzSd883mcbUQO64VWVoEi17K5lvjtBpkzBUeWs91CGtpU4XXLOWzft1gnEeri0rRSrjo79pMKfvCO+VR9shAJ1poi+L/8E6Lu6uAOOHcuckeJtTj5WRndWYu0toS+Ry2lVhV0JQEB6gFr1CrnInfiLQyqZBNqgr9X6ZmEJbFDsM+j3lXBMUDzpah2dhTATpsg/cLgWj4+pSt3C4qWQs= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM8PR08MB5665.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(376002)(346002)(136003)(396003)(39860400002)(230922051799003)(230173577357003)(230273577357003)(64100799003)(451199024)(186009)(1800799012)(41300700001)(38100700002)(122000001)(8676002)(66476007)(71200400001)(66899024)(316002)(8936002)(86362001)(36756003)(64756008)(66446008)(66556008)(33656002)(6636002)(54906003)(76116006)(91956017)(110136005)(66946007)(478600001)(6486002)(38070700009)(966005)(2906002)(6512007)(26005)(6506007)(53546011)(5660300002)(2616005)(83380400001)(4326008)(45980500001);DIR:OUT;SFP:1101; MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR08MB9458 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM1PEPF000252DE.eurprd07.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: f786b5e3-4b45-44d0-fdda-08dbfbd0fe0b X-Microsoft-Antispam-Message-Info: h87vDojM6bqTwEQ3Jiq/+SjgbiItakvRWFx1Vj5zqdV7MzVvjkqtIYiTRuZyi70Th2Q1dbyZx8o7KuUJm/EfxoQ8B4+8g/R0aHpfqLVjAVPJPzZhFDXNz4LzdoV/pO56QRxPWqPoUD4fx3EwlVfR9BtX593MGc/GSzwMaBKHgVrJvYs+o7GRCjoYRZTsGdTKBstyWoSotxBqzFpn90yzXFRMYyEJ/IVpyrD9nkRZk9g4f6OL/KvYsFY63ej3WkpenaRhWgLq7tH4KGImnLJRzThQryCDkh1DsKVQrFhqc/77pOafY24ENmFjm9bAiRlGKu24+wUJoWVl2JRwl8lbXSTGyqAwBDc1McKikRVlFPJIoV9/GPZBVQ4STClNKUWo2T9yHfpN/N3AziY0xhVm1y3RgYAudML2XSEWlrKC2Q8v4ssBbA5KUAdCVQ1i51pyFEV3oQBddlCVRASkXzDt0r8Tu1fLsZ4kFTTg7ypzrjb/3PtfeckTh8WUHp6ZSjcagIHV+hXVYip4Hf8dFIKtYwNJ8EkkigmDFEwAyXFrEqQRjeLV/KxDTADOEib/Rxdmt6LSlmgs5xu9HilsQMXbZdnMZVe0t1wToau2RXaV3z0otB+n+KBe5rawQLPcb6dNoZ4H6lB3inUR4JdnPaxVJspg6OphH0yTH2Gf34Wc0iqVkLmGYG7qPfgEIhu3JDwMVejaYpVhXsZylNm2+rxUVcoA0fEBhaqpD8W9ZJijI9lcfyQH22kmpuRusyad3x2w8Yjf0bC8F2zCFHj6MwFt3d60/TRziSqEhVvg5FHyPTlNcef1hswpoJ/ieVyQMOjk X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2023 11:45:37.7918 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eb561ada-6477-44a2-0327-08dbfbd10679 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM1PEPF000252DE.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6079 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,tom.pilar@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 2EnNruGj4JpvivaxMaSHC1dux7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-ID: <7DB1F344EC44744CA9EF39C73110844F@eurprd08.prod.outlook.com> Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=CAnkjh44; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") Hi Zhichao & Ray, Can you have a quick review of this patch, no logic has changed, just a cod= e tidy. Cheers, Tom > On 29 Nov 2023, at 18:28, Daniel Nguyen via groups.io wrote: >=20 > Warning: EXTERNAL SENDER, use caution when opening links or attachments. >=20 >=20 > Use error handling instead of success handling. > Less indented logic is easier to read. >=20 > Cc: Zhichao Gao > Cc: Ray Ni >=20 > Signed-off-by: Daniel Nguyen > --- > ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c | 41 +++++++++++-----= ---- > 1 file changed, 23 insertions(+), 18 deletions(-) >=20 > diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c b/ShellP= kg/Library/UefiShellLevel2CommandsLib/Reset.c > index 57ba3c90f373..361c47e43059 100644 > --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c > +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c > @@ -79,30 +79,35 @@ ShellCommandRunReset ( > &DataSize, > &OsIndications > ); > - if (!EFI_ERROR (Status)) { > - if ((OsIndications & EFI_OS_INDICATIONS_BOOT_TO_FW_UI) !=3D 0)= { > - DataSize =3D sizeof (OsIndications); > - Status =3D gRT->GetVariable ( > - EFI_OS_INDICATIONS_VARIABLE_NAME, > - &gEfiGlobalVariableGuid, > - &Attr, > - &DataSize, > - &OsIndications > - ); > - if (!EFI_ERROR (Status)) { > - OsIndications |=3D EFI_OS_INDICATIONS_BOOT_TO_FW_UI; > - } else { > - OsIndications =3D EFI_OS_INDICATIONS_BOOT_TO_FW_UI; > - } >=20 > - Status =3D gRT->SetVariable ( > + if (EFI_ERROR (Status)) { > + ShellStatus =3D SHELL_UNSUPPORTED; > + goto Error; > + } > + > + if ((OsIndications & EFI_OS_INDICATIONS_BOOT_TO_FW_UI) !=3D 0) { > + DataSize =3D sizeof (OsIndications); > + Status =3D gRT->GetVariable ( > EFI_OS_INDICATIONS_VARIABLE_NAME, > &gEfiGlobalVariableGuid, > - EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOO= TSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, > - sizeof (OsIndications), > + &Attr, > + &DataSize, > &OsIndications > ); > + > + if (EFI_ERROR (Status)) { > + OsIndications =3D EFI_OS_INDICATIONS_BOOT_TO_FW_UI; > + } else { > + OsIndications |=3D EFI_OS_INDICATIONS_BOOT_TO_FW_UI; > } > + > + Status =3D gRT->SetVariable ( > + EFI_OS_INDICATIONS_VARIABLE_NAME, > + &gEfiGlobalVariableGuid, > + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTS= ERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, > + sizeof (OsIndications), > + &OsIndications > + ); > } >=20 > if (EFI_ERROR (Status)) { > -- > 2.25.1 >=20 >=20 >=20 > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#111856): https://edk2.groups.io/g/devel/message/11185= 6 > Mute This Topic: https://groups.io/mt/102877864/7994090 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [tom.pilar@arm.com] > -=3D-=3D-=3D-=3D-=3D-=3D >=20 >=20 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112471): https://edk2.groups.io/g/devel/message/112471 Mute This Topic: https://groups.io/mt/102877864/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-