/*++\r
\r
-Copyright (c) 2005 - 2007, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials are licensed and made available\r
under the terms and conditions of the BSD License which accompanies this\r
distribution. The full text of the license may be found at\r
EFI_STATUS Status;\r
EFI_BLOCK_IO_PROTOCOL *BlockIo;\r
EFI_DISK_IO_PROTOCOL *DiskIo;\r
+ BOOLEAN LockedByMe;\r
+\r
+ LockedByMe = FALSE;\r
+ //\r
+ // Acquire the lock.\r
+ // If caller has already acquired the lock, cannot lock it again.\r
+ //\r
+ Status = FatAcquireLockOrFail ();\r
+ if (!EFI_ERROR (Status)) {\r
+ LockedByMe = TRUE;\r
+ }\r
\r
Status = InitializeUnicodeCollationSupport (This->DriverBindingHandle);\r
if (EFI_ERROR (Status)) {\r
- return Status;\r
+ goto Exit;\r
}\r
//\r
// Open our required BlockIo and DiskIo\r
EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
);\r
if (EFI_ERROR (Status)) {\r
- return Status;\r
+ goto Exit;\r
}\r
\r
Status = gBS->OpenProtocol (\r
EFI_OPEN_PROTOCOL_BY_DRIVER\r
);\r
if (EFI_ERROR (Status)) {\r
- return Status;\r
+ goto Exit;\r
}\r
//\r
// Allocate Volume structure. In FatAllocateVolume(), Resources\r
}\r
}\r
\r
+Exit:\r
+ //\r
+ // Unlock if locked by myself.\r
+ //\r
+ if (LockedByMe) {\r
+ FatReleaseLock ();\r
+ }\r
return Status;\r
}\r
\r