InitializeUnicodeCollationSupportWorker mixed the use of Status variable for OpenProtocol and return, it will cause the function to return EFI_SUCCESS even the proper UnicodeCollation is absent. Add ReturnStatus to hold the return status.

Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

(based on FatPkg commit c7046d14e7ebbb03282a5225ed43feee7889a9e9)

[jordan.l.justen@intel.com: Use script to relicense to 2-clause BSD]
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Mark Doran <mark.doran@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Star Zeng 2013-05-29 09:01:46 +00:00 committed by Jordan Justen
parent 3ba5368df0
commit 4a30cd67a5
1 changed files with 5 additions and 4 deletions

View File

@ -2,7 +2,7 @@
Unicode Collation Support component that hides the trivial difference of Unicode Collation
and Unicode collation 2 Protocol.
Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2007 - 2013, 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
@ -40,6 +40,7 @@ InitializeUnicodeCollationSupportWorker (
IN CONST CHAR8 *DefaultLanguage
)
{
EFI_STATUS ReturnStatus;
EFI_STATUS Status;
UINTN NumHandles;
UINTN Index;
@ -63,7 +64,7 @@ InitializeUnicodeCollationSupportWorker (
Iso639Language = (BOOLEAN) (ProtocolGuid == &gEfiUnicodeCollationProtocolGuid);
GetEfiGlobalVariable2 (VariableName, (VOID**) &Language, NULL);
Status = EFI_UNSUPPORTED;
ReturnStatus = EFI_UNSUPPORTED;
for (Index = 0; Index < NumHandles; Index++) {
//
// Open Unicode Collation Protocol
@ -94,7 +95,7 @@ InitializeUnicodeCollationSupportWorker (
if (BestLanguage != NULL) {
FreePool (BestLanguage);
mUnicodeCollationInterface = Uci;
Status = EFI_SUCCESS;
ReturnStatus = EFI_SUCCESS;
break;
}
}
@ -105,7 +106,7 @@ InitializeUnicodeCollationSupportWorker (
FreePool (Handles);
return Status;
return ReturnStatus;
}
/**