]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg: Fix Ecc error 5007 in SemihostFs
authorPierre Gondois <Pierre.Gondois@arm.com>
Thu, 10 Dec 2020 13:09:30 +0000 (13:09 +0000)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 6 Jan 2021 16:22:54 +0000 (16:22 +0000)
This patch fixes the following Ecc reported error:
There should be no initialization of a variable as
part of its declaration

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c

index 230f971f8bb4ac0f2bcf942cd88487552c0957be..6a06b38ab949d160d3b02f30db742f328b6c2534 100644 (file)
@@ -90,8 +90,9 @@ AllocateFCB (
   VOID\r
   )\r
 {\r
-  SEMIHOST_FCB *Fcb = AllocateZeroPool (sizeof (SEMIHOST_FCB));\r
+  SEMIHOST_FCB *Fcb;\r
 \r
+  Fcb = AllocateZeroPool (sizeof (SEMIHOST_FCB));\r
   if (Fcb != NULL) {\r
     CopyMem (&Fcb->File, &gSemihostFsFile, sizeof (gSemihostFsFile));\r
     Fcb->Signature = SEMIHOST_FCB_SIGNATURE;\r
@@ -122,7 +123,7 @@ VolumeOpen (
   OUT EFI_FILE                        **Root\r
   )\r
 {\r
-  SEMIHOST_FCB *RootFcb = NULL;\r
+  SEMIHOST_FCB *RootFcb;\r
 \r
   if (Root == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
@@ -759,12 +760,13 @@ GetFileInfo (
   OUT    VOID          *Buffer\r
   )\r
 {\r
-  EFI_FILE_INFO   *Info = NULL;\r
-  UINTN           NameSize = 0;\r
+  EFI_FILE_INFO   *Info;\r
+  UINTN           NameSize;\r
   UINTN           ResultSize;\r
   UINTN           Index;\r
 \r
   if (Fcb->IsRoot) {\r
+    NameSize = 0;\r
     ResultSize = SIZE_OF_EFI_FILE_INFO + sizeof(CHAR16);\r
   } else {\r
     NameSize   = AsciiStrLen (Fcb->FileName) + 1;\r