summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2017-08-29 19:33:09 +0800
committerHao Wu <hao.a.wu@intel.com>2017-08-30 19:14:20 +0800
commit7046a2739ae74f5d5c86ea18dc4bcc855e4916c6 (patch)
tree247e174a1f686c3df240e0c9243d4709b3355266
parentdb6f08a0eae66f5c8e9a91930d9bc78c7eb404bb (diff)
downloadedk2-7046a2739ae74f5d5c86ea18dc4bcc855e4916c6.zip
edk2-7046a2739ae74f5d5c86ea18dc4bcc855e4916c6.tar.gz
edk2-7046a2739ae74f5d5c86ea18dc4bcc855e4916c6.tar.bz2
IntelSiliconPkg/PlatformVTdSample: Avoid using constant result 'if'
In this sample driver, if (0) {...} else {...} statements were used to illustrate two different using scenarios. This comment refines the coding style by substituting the 'if (0)' statement with comments to select sample codes for different cases. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
-rw-r--r--IntelSiliconPkg/PlatformVTdSampleDxe/PlatformVTdSampleDxe.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/IntelSiliconPkg/PlatformVTdSampleDxe/PlatformVTdSampleDxe.c b/IntelSiliconPkg/PlatformVTdSampleDxe/PlatformVTdSampleDxe.c
index 07499c7..3587fa3 100644
--- a/IntelSiliconPkg/PlatformVTdSampleDxe/PlatformVTdSampleDxe.c
+++ b/IntelSiliconPkg/PlatformVTdSampleDxe/PlatformVTdSampleDxe.c
@@ -339,23 +339,33 @@ PlatformVTdGetExceptionDeviceList (
return EFI_INVALID_PARAMETER;
}
- if (0) {
- *DeviceInfo = AllocateZeroPool (sizeof(mExceptionDeviceScopeList));
- if (*DeviceInfo == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- CopyMem (*DeviceInfo, mExceptionDeviceScopeList, sizeof(mExceptionDeviceScopeList));
+ //
+ // Sample codes for device scope based exception list.
+ // Uncomment to take affect and comment the sample codes for PCI vendor id
+ // based exception list.
+ //
+ /*
+ *DeviceInfo = AllocateZeroPool (sizeof(mExceptionDeviceScopeList));
+ if (*DeviceInfo == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ CopyMem (*DeviceInfo, mExceptionDeviceScopeList, sizeof(mExceptionDeviceScopeList));
- *DeviceInfoCount = ARRAY_SIZE(mExceptionDeviceScopeList);
- } else {
- *DeviceInfo = AllocateZeroPool (sizeof(mExceptionPciDeviceIdList));
- if (*DeviceInfo == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- CopyMem (*DeviceInfo, mExceptionPciDeviceIdList, sizeof(mExceptionPciDeviceIdList));
+ *DeviceInfoCount = ARRAY_SIZE(mExceptionDeviceScopeList);
+ */
- *DeviceInfoCount = ARRAY_SIZE(mExceptionPciDeviceIdList);
+ //
+ // Sample codes for PCI vendor id based exception list.
+ // Uncomment to take affect and comment the sample codes for device scope
+ // based exception list.
+ //
+ *DeviceInfo = AllocateZeroPool (sizeof(mExceptionPciDeviceIdList));
+ if (*DeviceInfo == NULL) {
+ return EFI_OUT_OF_RESOURCES;
}
+ CopyMem (*DeviceInfo, mExceptionPciDeviceIdList, sizeof(mExceptionPciDeviceIdList));
+
+ *DeviceInfoCount = ARRAY_SIZE(mExceptionPciDeviceIdList);
return EFI_SUCCESS;
}