]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/PlatformIntelBdsLib: fix and clean up error handling
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 1 Sep 2015 17:28:57 +0000 (17:28 +0000)
committerabiesheuvel <abiesheuvel@Edk2>
Tue, 1 Sep 2015 17:28:57 +0000 (17:28 +0000)
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

ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c

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