summaryrefslogtreecommitdiff
path: root/FatPkg/EnhancedFatDxe
diff options
context:
space:
mode:
Diffstat (limited to 'FatPkg/EnhancedFatDxe')
-rw-r--r--FatPkg/EnhancedFatDxe/Fat.c26
-rw-r--r--FatPkg/EnhancedFatDxe/Init.c19
2 files changed, 24 insertions, 21 deletions
diff --git a/FatPkg/EnhancedFatDxe/Fat.c b/FatPkg/EnhancedFatDxe/Fat.c
index 67ee66c..38b7088 100644
--- a/FatPkg/EnhancedFatDxe/Fat.c
+++ b/FatPkg/EnhancedFatDxe/Fat.c
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2005 - 2007, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at
@@ -269,10 +269,21 @@ Returns:
EFI_STATUS Status;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
EFI_DISK_IO_PROTOCOL *DiskIo;
+ BOOLEAN LockedByMe;
+
+ LockedByMe = FALSE;
+ //
+ // Acquire the lock.
+ // If caller has already acquired the lock, cannot lock it again.
+ //
+ Status = FatAcquireLockOrFail ();
+ if (!EFI_ERROR (Status)) {
+ LockedByMe = TRUE;
+ }
Status = InitializeUnicodeCollationSupport (This->DriverBindingHandle);
if (EFI_ERROR (Status)) {
- return Status;
+ goto Exit;
}
//
// Open our required BlockIo and DiskIo
@@ -286,7 +297,7 @@ Returns:
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
- return Status;
+ goto Exit;
}
Status = gBS->OpenProtocol (
@@ -298,7 +309,7 @@ Returns:
EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (EFI_ERROR (Status)) {
- return Status;
+ goto Exit;
}
//
// Allocate Volume structure. In FatAllocateVolume(), Resources
@@ -330,6 +341,13 @@ Returns:
}
}
+Exit:
+ //
+ // Unlock if locked by myself.
+ //
+ if (LockedByMe) {
+ FatReleaseLock ();
+ }
return Status;
}
diff --git a/FatPkg/EnhancedFatDxe/Init.c b/FatPkg/EnhancedFatDxe/Init.c
index 5d86a83..ee258cd 100644
--- a/FatPkg/EnhancedFatDxe/Init.c
+++ b/FatPkg/EnhancedFatDxe/Init.c
@@ -51,8 +51,7 @@ Returns:
{
EFI_STATUS Status;
FAT_VOLUME *Volume;
- BOOLEAN LockedByMe;
- LockedByMe = FALSE;
+
//
// Allocate a volume structure
//
@@ -60,14 +59,7 @@ Returns:
if (Volume == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- //
- // Acquire the lock.
- // If caller has already acquired the lock, cannot lock it again.
- //
- Status = FatAcquireLockOrFail ();
- if (!EFI_ERROR (Status)) {
- LockedByMe = TRUE;
- }
+
//
// Initialize the structure
//
@@ -119,13 +111,6 @@ Returns:
Volume->Valid = TRUE;
Done:
- //
- // Unlock if locked by myself.
- //
- if (LockedByMe) {
- FatReleaseLock ();
- }
-
if (EFI_ERROR (Status)) {
FatFreeVolume (Volume);
}