MdeModulePkg/Udf: Avoid declaring and initializing local GUID variable

The local GUID variable 'UdfDevPathGuid', it has been initialized during
its declaration.

For better coding style, this commit uses a global variable instead.

Cc: Paulo Alcantara <pcacjr@zytor.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Paulo Alcantara <pcacjr@zytor.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
Hao Wu 2017-09-15 08:43:22 +08:00
parent 32492fee2d
commit 3f92b10493
2 changed files with 12 additions and 4 deletions

View File

@ -27,6 +27,11 @@ typedef struct {
EFI_DEVICE_PATH_PROTOCOL End;
} UDF_DEVICE_PATH;
//
// Vendor-Defined Device Path GUID for UDF file system
//
EFI_GUID gUdfDevPathGuid = EFI_UDF_DEVICE_PATH_GUID;
//
// Vendor-Defined Media Device Path for UDF file system
//
@ -260,7 +265,6 @@ PartitionInstallUdfChildHandles (
EFI_BLOCK_IO_MEDIA *Media;
EFI_DEVICE_PATH_PROTOCOL *DevicePathNode;
EFI_GUID *VendorDefinedGuid;
EFI_GUID UdfDevPathGuid = EFI_UDF_DEVICE_PATH_GUID;
EFI_PARTITION_INFO_PROTOCOL PartitionInfo;
Media = BlockIo->Media;
@ -291,7 +295,7 @@ PartitionInstallUdfChildHandles (
if (DevicePathSubType (DevicePathNode) == MEDIA_VENDOR_DP) {
VendorDefinedGuid = (EFI_GUID *)((UINTN)DevicePathNode +
OFFSET_OF (VENDOR_DEVICE_PATH, Guid));
if (CompareGuid (VendorDefinedGuid, &UdfDevPathGuid)) {
if (CompareGuid (VendorDefinedGuid, &gUdfDevPathGuid)) {
return EFI_NOT_FOUND;
}
}

View File

@ -14,6 +14,11 @@
#include "Udf.h"
//
// Vendor-Defined Device Path GUID for UDF file system
//
EFI_GUID gUdfDevPathGuid = EFI_UDF_DEVICE_PATH_GUID;
/**
Find the anchor volume descriptor pointer.
@ -2650,7 +2655,6 @@ SupportUdfFileSystem (
EFI_DEVICE_PATH_PROTOCOL *DevicePathNode;
EFI_DEVICE_PATH_PROTOCOL *LastDevicePathNode;
EFI_GUID *VendorDefinedGuid;
EFI_GUID UdfDevPathGuid = EFI_UDF_DEVICE_PATH_GUID;
//
// Open Device Path protocol on ControllerHandle
@ -2687,7 +2691,7 @@ SupportUdfFileSystem (
DevicePathSubType (LastDevicePathNode) == MEDIA_VENDOR_DP) {
VendorDefinedGuid = (EFI_GUID *)((UINTN)LastDevicePathNode +
OFFSET_OF (VENDOR_DEVICE_PATH, Guid));
if (CompareGuid (VendorDefinedGuid, &UdfDevPathGuid)) {
if (CompareGuid (VendorDefinedGuid, &gUdfDevPathGuid)) {
Status = EFI_SUCCESS;
}
}