ShellPkg: Tidy for code readability

Use error handling instead of success handling.
Less indented logic is easier to read.

Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>

Signed-off-by: Daniel Nguyen <daniel.nguyen@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
This commit is contained in:
Daniel Nguyen 2023-11-30 02:28:40 +08:00 committed by mergify[bot]
parent 3ce5f2d445
commit 74daeded0c
1 changed files with 23 additions and 18 deletions

View File

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