]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelSiliconPkg/PlatformVTdSample: Avoid using constant result 'if'
authorHao Wu <hao.a.wu@intel.com>
Tue, 29 Aug 2017 11:33:09 +0000 (19:33 +0800)
committerHao Wu <hao.a.wu@intel.com>
Wed, 30 Aug 2017 11:14:20 +0000 (19:14 +0800)
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>
IntelSiliconPkg/PlatformVTdSampleDxe/PlatformVTdSampleDxe.c

index 07499c7da81eb1a54a7e0133e5a0e18898addbf6..3587fa3c83453470c3e3446e7b1010d0ff77fc86 100644 (file)
@@ -339,23 +339,33 @@ PlatformVTdGetExceptionDeviceList (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  if (0) {\r
-    *DeviceInfo = AllocateZeroPool (sizeof(mExceptionDeviceScopeList));\r
-    if (*DeviceInfo == NULL) {\r
-      return EFI_OUT_OF_RESOURCES;\r
-    }\r
-    CopyMem (*DeviceInfo, mExceptionDeviceScopeList, sizeof(mExceptionDeviceScopeList));\r
+  //\r
+  // Sample codes for device scope based exception list.\r
+  // Uncomment to take affect and comment the sample codes for PCI vendor id\r
+  // based exception list.\r
+  //\r
+  /*\r
+  *DeviceInfo = AllocateZeroPool (sizeof(mExceptionDeviceScopeList));\r
+  if (*DeviceInfo == NULL) {\r
+    return EFI_OUT_OF_RESOURCES;\r
+  }\r
+  CopyMem (*DeviceInfo, mExceptionDeviceScopeList, sizeof(mExceptionDeviceScopeList));\r
 \r
 \r
-    *DeviceInfoCount = ARRAY_SIZE(mExceptionDeviceScopeList);\r
-  } else {\r
-    *DeviceInfo = AllocateZeroPool (sizeof(mExceptionPciDeviceIdList));\r
-    if (*DeviceInfo == NULL) {\r
-      return EFI_OUT_OF_RESOURCES;\r
-    }\r
-    CopyMem (*DeviceInfo, mExceptionPciDeviceIdList, sizeof(mExceptionPciDeviceIdList));\r
+  *DeviceInfoCount = ARRAY_SIZE(mExceptionDeviceScopeList);\r
+  */\r
 \r
 \r
-    *DeviceInfoCount = ARRAY_SIZE(mExceptionPciDeviceIdList);\r
+  //\r
+  // Sample codes for PCI vendor id based exception list.\r
+  // Uncomment to take affect and comment the sample codes for device scope\r
+  // based exception list.\r
+  //\r
+  *DeviceInfo = AllocateZeroPool (sizeof(mExceptionPciDeviceIdList));\r
+  if (*DeviceInfo == NULL) {\r
+    return EFI_OUT_OF_RESOURCES;\r
   }\r
   }\r
+  CopyMem (*DeviceInfo, mExceptionPciDeviceIdList, sizeof(mExceptionPciDeviceIdList));\r
+\r
+  *DeviceInfoCount = ARRAY_SIZE(mExceptionPciDeviceIdList);\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
   return EFI_SUCCESS;\r
 }\r