]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BasePciExpressLib/PciLib.c
PciLib:
[mirror_edk2.git] / MdePkg / Library / BasePciExpressLib / PciLib.c
index 036994aa7b95f04660573bbe6e1bccb78867dac0..acd31034835f90d56efc381afbb92889a3766c0f 100644 (file)
@@ -1196,11 +1196,16 @@ PciExpressReadBuffer (
 \r
   ASSERT_INVALID_PCI_ADDRESS (StartAddress);\r
   ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);\r
-  ASSERT ((Buffer != NULL) || (Size == 0));\r
+\r
+  if (Size == 0) {\r
+    return 0;\r
+  }\r
+\r
+  ASSERT (Buffer != NULL);\r
 \r
   EndAddress = StartAddress + Size;\r
 \r
-  if ((StartAddress < EndAddress) && ((StartAddress & 1) != 0)) {\r
+  if ((StartAddress & 1) != 0) {\r
     //\r
     // Read a byte if StartAddress is byte aligned\r
     //\r
@@ -1282,11 +1287,16 @@ PciExpressWriteBuffer (
 \r
   ASSERT_INVALID_PCI_ADDRESS (StartAddress);\r
   ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);\r
-  ASSERT ((Buffer != NULL) || (Size == 0));\r
+\r
+  if (Size == 0) {\r
+    return 0;\r
+  }\r
+\r
+  ASSERT (Buffer != NULL);\r
 \r
   EndAddress = StartAddress + Size;\r
 \r
-  if ((StartAddress < EndAddress) && ((StartAddress & 1) != 0)) {\r
+  if ((StartAddress & 1) != 0) {\r
     //\r
     // Write a byte if StartAddress is byte aligned\r
     //\r