]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Application/Shell/ShellProtocol.c
ShellPkg/Shell: Check the OpenVolume result in OpenRootByHandle()
[mirror_edk2.git] / ShellPkg / Application / Shell / ShellProtocol.c
index dc3deee071756dbe6c07130d52968491f37bd46e..d8b1e065e00a05243b6ece0ff1cf4e4ba01d0162 100644 (file)
@@ -827,7 +827,8 @@ EfiShellGetDeviceName(
   @retval EFI_NOT_FOUND         EFI_SIMPLE_FILE_SYSTEM could not be found or the root directory\r
                                 could not be opened.\r
   @retval EFI_VOLUME_CORRUPTED  The data structures in the volume were corrupted.\r
-  @retval EFI_DEVICE_ERROR      The device had an error\r
+  @retval EFI_DEVICE_ERROR      The device had an error.\r
+  @retval Others                Error status returned from EFI_SIMPLE_FILE_SYSTEM_PROTOCOL->OpenVolume().\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -867,8 +868,12 @@ EfiShellOpenRootByHandle(
   // Open the root volume now...\r
   //\r
   Status = SimpleFileSystem->OpenVolume(SimpleFileSystem, &RealFileHandle);\r
+  if (EFI_ERROR(Status)) {\r
+    return Status;\r
+  }\r
+\r
   *FileHandle = ConvertEfiFileProtocolToShellHandle(RealFileHandle, EfiShellGetMapFromDevicePath(&DevPath));\r
-  return (Status);\r
+  return (EFI_SUCCESS);\r
 }\r
 \r
 /**\r