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,7 +79,12 @@ ShellCommandRunReset (
&DataSize, &DataSize,
&OsIndications &OsIndications
); );
if (!EFI_ERROR (Status)) {
if (EFI_ERROR (Status)) {
ShellStatus = SHELL_UNSUPPORTED;
goto Error;
}
if ((OsIndications & EFI_OS_INDICATIONS_BOOT_TO_FW_UI) != 0) { if ((OsIndications & EFI_OS_INDICATIONS_BOOT_TO_FW_UI) != 0) {
DataSize = sizeof (OsIndications); DataSize = sizeof (OsIndications);
Status = gRT->GetVariable ( Status = gRT->GetVariable (
@ -89,10 +94,11 @@ ShellCommandRunReset (
&DataSize, &DataSize,
&OsIndications &OsIndications
); );
if (!EFI_ERROR (Status)) {
OsIndications |= EFI_OS_INDICATIONS_BOOT_TO_FW_UI; if (EFI_ERROR (Status)) {
} else {
OsIndications = EFI_OS_INDICATIONS_BOOT_TO_FW_UI; OsIndications = EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
} else {
OsIndications |= EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
} }
Status = gRT->SetVariable ( Status = gRT->SetVariable (
@ -103,7 +109,6 @@ ShellCommandRunReset (
&OsIndications &OsIndications
); );
} }
}
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ShellStatus = SHELL_UNSUPPORTED; ShellStatus = SHELL_UNSUPPORTED;