Revision: 18376
          http://sourceforge.net/p/edk2/code/18376
Author:   abiesheuvel
Date:     2015-09-01 17:28:57 +0000 (Tue, 01 Sep 2015)
Log Message:
-----------
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 <[email protected]>
Reviewed-by: Leif Lindholm <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c

Modified: 
trunk/edk2/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
===================================================================
--- trunk/edk2/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c    
2015-09-01 17:28:48 UTC (rev 18375)
+++ trunk/edk2/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c    
2015-09-01 17:28:57 UTC (rev 18376)
@@ -154,12 +154,12 @@
     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));


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to