public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH] Modified ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c to follow error handling instead of success handling
@ 2023-11-16  6:16 Daniel Nguyen
  2023-11-21 16:25 ` Laszlo Ersek
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Nguyen @ 2023-11-16  6:16 UTC (permalink / raw)
  To: devel; +Cc: Daniel Nguyen

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)) {
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111429): https://edk2.groups.io/g/devel/message/111429
Mute This Topic: https://groups.io/mt/102698984/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [PATCH] Modified ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c to follow error handling instead of success handling
  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
  2023-11-22  1:33   ` Gao, Zhichao
  0 siblings, 1 reply; 3+ messages in thread
From: Laszlo Ersek @ 2023-11-21 16:25 UTC (permalink / raw)
  To: devel, daniel.nguyen; +Cc: Zhichao Gao

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]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [PATCH] Modified ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c to follow error handling instead of success handling
  2023-11-21 16:25 ` Laszlo Ersek
@ 2023-11-22  1:33   ` Gao, Zhichao
  0 siblings, 0 replies; 3+ messages in thread
From: Gao, Zhichao @ 2023-11-22  1:33 UTC (permalink / raw)
  To: devel@edk2.groups.io, lersek@redhat.com, daniel.nguyen@arm.com

Please follow https://github.com/tianocore/tianocore.github.io/wiki/Commit-Message-Format for the commit message.

And introduce why you need to make the change. The error handling would be taken care later.

Thanks,
Zhichao

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Laszlo
> Ersek
> Sent: Wednesday, November 22, 2023 12:25 AM
> To: devel@edk2.groups.io; daniel.nguyen@arm.com
> Cc: Gao, Zhichao <zhichao.gao@intel.com>
> Subject: Re: [edk2-devel] [PATCH] Modified
> ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c to follow error
> handling instead of success handling
> 
> 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 (#111591): https://edk2.groups.io/g/devel/message/111591
Mute This Topic: https://groups.io/mt/102698984/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-22  1:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2023-11-22  1:33   ` Gao, Zhichao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox