diff options
author | Laszlo Ersek <lersek@redhat.com> | 2016-01-21 18:40:00 +0000 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2016-07-13 20:41:25 +0800 |
commit | 6c78eca61c0e99a73001550aa959c6f5002c45d4 (patch) | |
tree | 32cfff4915073c405cbad898ed345f542005d1fd /ShellPkg | |
parent | b39764a41802ab7ba276a2e7ab2619bc995dcf71 (diff) | |
download | edk2-platforms-6c78eca61c0e99a73001550aa959c6f5002c45d4.tar.xz |
ShellPkg: BcfgDisplayDump(): hoist NULL-init of DevPath[String]
It will help with error handling if we move these initializations near the
top of the loop body.
This patch is not supposed to change behavior.
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ryan Harkin <ryan.harkin@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19708 6f19259b-4bc3-4df7-8a09-765794883524
(cherry picked from commit 43da602cb4e14efa921a359afb9c4c06c7138eba)
Diffstat (limited to 'ShellPkg')
-rw-r--r-- | ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c index f6f4ab35ef..f5ae7bc0d9 100644 --- a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c +++ b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c @@ -1060,6 +1060,9 @@ BcfgDisplayDump( for (LoopVar = 0 ; LoopVar < OrderCount ; LoopVar++) {
Buffer = NULL;
BufferSize = 0;
+ DevPath = NULL;
+ DevPathString = NULL;
+
UnicodeSPrint(VariableName, sizeof(VariableName), L"%s%04x", Op, CurrentOrder[LoopVar]);
Status = gRT->GetVariable(
@@ -1085,15 +1088,10 @@ BcfgDisplayDump( if ((*(UINT16*)(Buffer+4)) != 0) {
DevPath = AllocateZeroPool(*(UINT16*)(Buffer+4));
- if (DevPath == NULL) {
- DevPathString = NULL;
- } else {
+ if (DevPath != NULL) {
CopyMem(DevPath, Buffer+6+StrSize((CHAR16*)(Buffer+6)), *(UINT16*)(Buffer+4));
DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE);
}
- } else {
- DevPath = NULL;
- DevPathString = NULL;
}
ShellPrintHiiEx(
-1,
|