public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: devel@edk2.groups.io, daniel.nguyen@arm.com
Cc: Zhichao Gao <zhichao.gao@intel.com>
Subject: Re: [edk2-devel] [PATCH] Modified ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c to follow error handling instead of success handling
Date: Tue, 21 Nov 2023 17:25:23 +0100	[thread overview]
Message-ID: <3d456459-8bf2-39a2-0e97-d3f92615e94d@redhat.com> (raw)
In-Reply-To: <26fd376786f612b73bf15748b1409e30cb13b860.1700115374.git.daniel.nguyen@arm.com>

On 11/16/23 07:16, Daniel Nguyen wrote:
> Signed-off-by: Daniel Nguyen <daniel.nguyen@arm.com>
> ---
>  .../UefiShellLevel2CommandsLib/Reset.c        | 43 +++++++++++--------
>  1 file changed, 24 insertions(+), 19 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c b/ShellPkg/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) != 0) {
> -            DataSize = sizeof (OsIndications);
> -            Status   = gRT->GetVariable (
> -                              EFI_OS_INDICATIONS_VARIABLE_NAME,
> -                              &gEfiGlobalVariableGuid,
> -                              &Attr,
> -                              &DataSize,
> -                              &OsIndications
> -                              );
> -            if (!EFI_ERROR (Status)) {
> -              OsIndications |= EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
> -            } else {
> -              OsIndications = EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
> -            }
> -
> -            Status = gRT->SetVariable (
> +
> +        if (EFI_ERROR (Status)) {
> +          ShellStatus = SHELL_UNSUPPORTED;
> +          goto Error;
> +        }
> +
> +        if ((OsIndications & EFI_OS_INDICATIONS_BOOT_TO_FW_UI) != 0) {
> +          DataSize = sizeof (OsIndications);
> +          Status   = gRT->GetVariable (
>                              EFI_OS_INDICATIONS_VARIABLE_NAME,
>                              &gEfiGlobalVariableGuid,
> -                            EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
> -                            sizeof (OsIndications),
> +                            &Attr,
> +                            &DataSize,
>                              &OsIndications
>                              );
> +
> +          if (EFI_ERROR (Status)) {
> +            OsIndications = EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
> +          } else {
> +            OsIndications |= EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
>            }
> +
> +          Status = gRT->SetVariable (
> +                          EFI_OS_INDICATIONS_VARIABLE_NAME,
> +                          &gEfiGlobalVariableGuid,
> +                          EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
> +                          sizeof (OsIndications),
> +                          &OsIndications
> +                          );
>          }
>  
>          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



-=-=-=-=-=-=-=-=-=-=-=-
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/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2023-11-21 16:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-16  6:16 [edk2-devel] [PATCH] Modified ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c to follow error handling instead of success handling Daniel Nguyen
2023-11-21 16:25 ` Laszlo Ersek [this message]
2023-11-22  1:33   ` Gao, Zhichao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3d456459-8bf2-39a2-0e97-d3f92615e94d@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox