ArmPlatformPkg/PlatformIntelBdsLib: fix and clean up error handling

InitializeConsolePipe () shadowed its own Status variable, and then
clobbered the top one before printing its error message. Instead,
use a NULL check on the LocateProtocol () output argument.
Also clean up coding style on the error path.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18376 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Ard Biesheuvel 2015-09-01 17:28:57 +00:00 committed by abiesheuvel
parent 3baf5c9fc9
commit 3d175bcb6e
1 changed files with 5 additions and 5 deletions

View File

@ -154,12 +154,12 @@ InitializeConsolePipe (
DEBUG_CODE_BEGIN();
if (EFI_ERROR(Status)) {
// We convert back to the text representation of the device Path
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
CHAR16* DevicePathTxt;
EFI_STATUS Status;
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevicePathToTextProtocol;
CHAR16 *DevicePathTxt;
Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
if (!EFI_ERROR(Status)) {
DevicePathToTextProtocol = NULL;
gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **) &DevicePathToTextProtocol);
if (DevicePathToTextProtocol != NULL) {
DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (DevicePath, TRUE, TRUE);
DEBUG((EFI_D_ERROR,"Fail to start the console with the Device Path '%s'. (Error '%r')\n", DevicePathTxt, Status));