Cc: Brijesh Singh <[email protected]>
Cc: Leo Duran  <[email protected]>
Cc: Liming Gao <[email protected]>
Signed-off-by: Leo Duran  <[email protected]>
Reviewed-by: Liming Gao <[email protected]>

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <[email protected]>
---
 MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c         | 12 ++++++------
 MdePkg/Library/DxeIoLibCpuIo2/DxeCpuIo2LibInternal.h |  1 -
 MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c             | 12 ++++++------
 3 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c 
b/MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c
index e388549..b84134b 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c
@@ -280,11 +280,11 @@ IoReadFifo8 (
   )
 {
   UINT8 *Buffer8;
 
   Buffer8 = (UINT8 *)Buffer;
-  while (Count--) {
+  while (Count-- > 0) {
     *Buffer8++ = IoRead8 (Port);
   }
 }
 
 /**
@@ -313,11 +313,11 @@ IoReadFifo16 (
   )
 {
   UINT16 *Buffer16;
 
   Buffer16 = (UINT16 *)Buffer;
-  while (Count--) {
+  while (Count-- > 0) {
     *Buffer16++ = IoRead16 (Port);
   }
 }
 
 /**
@@ -346,11 +346,11 @@ IoReadFifo32 (
   )
 {
   UINT32 *Buffer32;
 
   Buffer32 = (UINT32 *)Buffer;
-  while (Count--) {
+  while (Count-- > 0) {
     *Buffer32++ = IoRead32 (Port);
   }
 }
 
 /**
@@ -379,11 +379,11 @@ IoWriteFifo8 (
   )
 {
   UINT8 *Buffer8;
 
   Buffer8 = (UINT8 *)Buffer;
-  while (Count--) {
+  while (Count-- > 0) {
     IoWrite8 (Port, *Buffer8++);
   }
 }
 
 /**
@@ -412,11 +412,11 @@ IoWriteFifo16 (
   )
 {
   UINT16 *Buffer16;
 
   Buffer16 = (UINT16 *)Buffer;
-  while (Count--) {
+  while (Count-- > 0) {
     IoWrite16 (Port, *Buffer16++);
   }
 }
 
 /**
@@ -445,11 +445,11 @@ IoWriteFifo32 (
   )
 {
   UINT32 *Buffer32;
 
   Buffer32 = (UINT32 *)Buffer;
-  while (Count--) {
+  while (Count-- > 0) {
     IoWrite32 (Port, *Buffer32++);
   }
 }
 
 /**
diff --git a/MdePkg/Library/DxeIoLibCpuIo2/DxeCpuIo2LibInternal.h 
b/MdePkg/Library/DxeIoLibCpuIo2/DxeCpuIo2LibInternal.h
index c84ce6b..8c289cb 100644
--- a/MdePkg/Library/DxeIoLibCpuIo2/DxeCpuIo2LibInternal.h
+++ b/MdePkg/Library/DxeIoLibCpuIo2/DxeCpuIo2LibInternal.h
@@ -133,11 +133,10 @@ IoWriteFifoWorker (
   This function must guarantee that all MMIO read and write operations are 
serialized.
 
   @param  Address       The MMIO register to read.
                         The caller is responsible for aligning the Address if 
required.
   @param  Width         The width of the I/O operation.
-  @param  Count         The number of times to write I/O port.
 
   @return Data read from registers in the EFI system memory space.
 
 **/
 UINT64
diff --git a/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c 
b/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c
index 0279bde..69acb80 100644
--- a/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c
+++ b/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c
@@ -394,11 +394,11 @@ IoReadFifo8 (
   )
 {
   UINT8 *Buffer8;
 
   Buffer8 = (UINT8 *)Buffer;
-  while (Count--) {
+  while (Count-- > 0) {
     *Buffer8++ = IoRead8 (Port);
   }
 }
 
 /**
@@ -427,11 +427,11 @@ IoWriteFifo8 (
   )
 {
   UINT8 *Buffer8;
 
   Buffer8 = (UINT8 *)Buffer;
-  while (Count--) {
+  while (Count-- > 0) {
     IoWrite8 (Port, *Buffer8++);
   }
 }
 
 /**
@@ -464,11 +464,11 @@ IoReadFifo16 (
   //
   // Make sure Port is aligned on a 16-bit boundary.
   //
   ASSERT ((Port & 1) == 0);
   Buffer16 = (UINT16 *)Buffer;
-  while (Count--) {
+  while (Count-- > 0) {
     *Buffer16++ = IoRead16 (Port);
   }
 }
 
 /**
@@ -501,11 +501,11 @@ IoWriteFifo16 (
   //
   // Make sure Port is aligned on a 16-bit boundary.
   //
   ASSERT ((Port & 1) == 0);
   Buffer16 = (UINT16 *)Buffer;
-  while (Count--) {
+  while (Count-- > 0) {
     IoWrite16 (Port, *Buffer16++);
   }
 }
 
 /**
@@ -538,11 +538,11 @@ IoReadFifo32 (
   //
   // Make sure Port is aligned on a 32-bit boundary.
   //
   ASSERT ((Port & 3) == 0);
   Buffer32 = (UINT32 *)Buffer;
-  while (Count--) {
+  while (Count-- > 0) {
     *Buffer32++ = IoRead32 (Port);
   }
 }
 
 /**
@@ -575,11 +575,11 @@ IoWriteFifo32 (
   //
   // Make sure Port is aligned on a 32-bit boundary.
   //
   ASSERT ((Port & 3) == 0);
   Buffer32 = (UINT32 *)Buffer;
-  while (Count--) {
+  while (Count-- > 0) {
     IoWrite32 (Port, *Buffer32++);
   }
 }
 
 /**
-- 
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to