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 076FFD80A5F for ; Tue, 21 Nov 2023 16:25:31 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=w5bI+pzqxdost0ixShlkSsKqZBEAlHly1Ejlq/4eUXA=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:References:Cc:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1700583930; v=1; b=K/W4s8Hj73XxDjy+LMjgiHBQjqGGPW+g0VDrkZEGNoR4HhkubYmzJAxFwBEAmroVev2dWy09 Sfvuaq2/cm1KnP1CpkXegaT1oMojkboTH0zKtZkwHv/7QGljJDdnc6VcITIuv0KEGki/eEZgwrq 2GY+3II5DoZJrjV/TnwDBm18= X-Received: by 127.0.0.2 with SMTP id eflRYY7687511xjc42RyoJWQ; Tue, 21 Nov 2023 08:25:30 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.45810.1700583929988606800 for ; Tue, 21 Nov 2023 08:25:30 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-691-rz5VpN1wOfykkCUzoPoXwg-1; Tue, 21 Nov 2023 11:25:25 -0500 X-MC-Unique: rz5VpN1wOfykkCUzoPoXwg-1 X-Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 94AC7101A53B; Tue, 21 Nov 2023 16:25:25 +0000 (UTC) X-Received: from [10.39.194.228] (unknown [10.39.194.228]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EBA2E1121306; Tue, 21 Nov 2023 16:25:24 +0000 (UTC) Message-ID: <3d456459-8bf2-39a2-0e97-d3f92615e94d@redhat.com> Date: Tue, 21 Nov 2023 17:25:23 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH] Modified ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c to follow error handling instead of success handling To: devel@edk2.groups.io, daniel.nguyen@arm.com References: <26fd376786f612b73bf15748b1409e30cb13b860.1700115374.git.daniel.nguyen@arm.com> Cc: Zhichao Gao From: "Laszlo Ersek" In-Reply-To: <26fd376786f612b73bf15748b1409e30cb13b860.1700115374.git.daniel.nguyen@arm.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: bvWEDA2MdrTZ5AasfWMMAyZOx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 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="K/W4s8Hj"; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none) On 11/16/23 07:16, Daniel Nguyen wrote: > Signed-off-by: Daniel Nguyen > --- > .../UefiShellLevel2CommandsLib/Reset.c | 43 +++++++++++-------- > 1 file changed, 24 insertions(+), 19 deletions(-) >=20 > diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c b/ShellP= kg/Library/UefiShellLevel2CommandsLib/Reset.c > index 57ba3c90f3..361c47e430 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; > - } > - > - 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)) { Adding Zhichao to the CC list. >From a quick skim, the subject line and the commit message are not great (the former is too long, the latter is empty). Laszlo -=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 (#111562): https://edk2.groups.io/g/devel/message/111562 Mute This Topic: https://groups.io/mt/102698984/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-