Reviewed-by: Jaben Carsey <[email protected]>

-----Original Message-----
From: Qiu, Shumin 
Sent: Tuesday, October 27, 2015 6:38 AM
To: [email protected]
Cc: Qiu, Shumin <[email protected]>; Carsey, Jaben <[email protected]>
Subject: [PATCH] ShellPkg: Refine code by initializing local variable and 
adding ASSERT statement.
Importance: High

Add ASSERT statement and initialize local variable to make code more readable.

Cc: Jaben Carsey <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <[email protected]>
---
 ShellPkg/Application/Shell/ShellProtocol.c      | 2 ++
 ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c | 1 +
 2 files changed, 3 insertions(+)

diff --git a/ShellPkg/Application/Shell/ShellProtocol.c 
b/ShellPkg/Application/Shell/ShellProtocol.c
index af00fe4..fc13595 100644
--- a/ShellPkg/Application/Shell/ShellProtocol.c
+++ b/ShellPkg/Application/Shell/ShellProtocol.c
@@ -1632,6 +1632,8 @@ EfiShellExecute(
   EFI_DEVICE_PATH_PROTOCOL  *DevPath;
   UINTN                     Size;
   EFI_STATUS                CalleeStatusCode;
+
+  CalleeStatusCode = EFI_SUCCESS;
   
   if ((PcdGet8(PcdShellSupportLevel) < 1)) {
     return (EFI_UNSUPPORTED);
diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c 
b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
index 02099fe..831b9c3 100644
--- a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
+++ b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
@@ -341,6 +341,7 @@ ShellCommandRunTftp (
   }
 
   RemoteFilePath = ShellCommandLineGetRawValue (CheckPackage, 2);
+  ASSERT(RemoteFilePath != NULL);
   AsciiRemoteFilePath = AllocatePool (
                           (StrLen (RemoteFilePath) + 1) * sizeof (CHAR8)
                           );
-- 
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to