]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemEntryPoint.c
MdeModulePkg DxeCore: Fix issue to print GUID value %g without pointer
[mirror_edk2.git] / MdeModulePkg / Universal / FvSimpleFileSystemDxe / FvSimpleFileSystemEntryPoint.c
index 975ab88ca1cf47df7d86212785530d3a19e1e92a..4e6089b057192c268117a6df9c564e03b44dd81b 100644 (file)
@@ -12,7 +12,7 @@
   from the UEFI shell. It is entirely read-only.\r
 \r
 Copyright (c) 2014, ARM Limited. All rights reserved.\r
-Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
@@ -223,7 +223,11 @@ FvSimpleFileSystemOpenVolume (
     }\r
   }\r
 \r
-  Instance->Root->DirReadNext = FVFS_GET_FIRST_FILE_INFO (Instance);\r
+  Instance->Root->DirReadNext = NULL;\r
+  if (!IsListEmpty (&Instance->FileInfoHead)) {\r
+    Instance->Root->DirReadNext = FVFS_GET_FIRST_FILE_INFO (Instance);\r
+  }\r
+\r
   *RootFile = &Instance->Root->FileProtocol;\r
   return Status;\r
 }\r
@@ -452,9 +456,7 @@ FvSimpleFileSystemDriverStart (
   // Create an instance\r
   //\r
   Instance = AllocateZeroPool (sizeof (FV_FILESYSTEM_INSTANCE));\r
-  if (Instance == NULL) {\r
-    return EFI_OUT_OF_RESOURCES;\r
-  }\r
+  ASSERT (Instance != NULL);\r
 \r
   Instance->Root = NULL;\r
   Instance->FvProtocol = FvProtocol;\r
@@ -469,6 +471,7 @@ FvSimpleFileSystemDriverStart (
                   EFI_NATIVE_INTERFACE,\r
                   &Instance->SimpleFs\r
                   );\r
+  ASSERT_EFI_ERROR (Status);\r
 \r
   //\r
   // Decide on a filesystem volume label, which will include the FV's guid.\r
@@ -481,7 +484,7 @@ FvSimpleFileSystemDriverStart (
                    (VOID **) &FvDevicePath,\r
                    gImageHandle,\r
                    ControllerHandle,\r
-                   EFI_OPEN_PROTOCOL_BY_DRIVER\r
+                   EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
                    );\r
   if (!EFI_ERROR (Status)) {\r
     //\r
@@ -528,7 +531,7 @@ FvSimpleFileSystemDriverStart (
                               );\r
   }\r
 \r
-  return Status;\r
+  return EFI_SUCCESS;\r
 }\r
 \r
 /**\r