public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [patch] MdePkg: Avoid Non-Boolean type used as Boolean
@ 2017-01-20  0:54 Dandan Bi
  2017-01-20  3:15 ` Gao, Liming
  2017-01-20 15:52 ` Duran, Leo
  0 siblings, 2 replies; 3+ messages in thread
From: Dandan Bi @ 2017-01-20  0:54 UTC (permalink / raw)
  To: edk2-devel; +Cc: Brijesh Singh, Leo Duran, Liming Gao

Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Leo Duran  <leo.duran@amd.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Leo Duran  <leo.duran@amd.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] MdePkg: Avoid Non-Boolean type used as Boolean
  2017-01-20  0:54 [patch] MdePkg: Avoid Non-Boolean type used as Boolean Dandan Bi
@ 2017-01-20  3:15 ` Gao, Liming
  2017-01-20 15:52 ` Duran, Leo
  1 sibling, 0 replies; 3+ messages in thread
From: Gao, Liming @ 2017-01-20  3:15 UTC (permalink / raw)
  To: Bi, Dandan, edk2-devel@lists.01.org; +Cc: Brijesh Singh, Leo Duran

Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: Bi, Dandan
>Sent: Friday, January 20, 2017 8:54 AM
>To: edk2-devel@lists.01.org
>Cc: Brijesh Singh <brijesh.singh@amd.com>; Leo Duran
><leo.duran@amd.com>; Gao, Liming <liming.gao@intel.com>
>Subject: [patch] MdePkg: Avoid Non-Boolean type used as Boolean
>
>Cc: Brijesh Singh <brijesh.singh@amd.com>
>Cc: Leo Duran  <leo.duran@amd.com>
>Cc: Liming Gao <liming.gao@intel.com>
>Signed-off-by: Leo Duran  <leo.duran@amd.com>
>Reviewed-by: Liming Gao <liming.gao@intel.com>
>
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Dandan Bi <dandan.bi@intel.com>
>---
> 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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] MdePkg: Avoid Non-Boolean type used as Boolean
  2017-01-20  0:54 [patch] MdePkg: Avoid Non-Boolean type used as Boolean Dandan Bi
  2017-01-20  3:15 ` Gao, Liming
@ 2017-01-20 15:52 ` Duran, Leo
  1 sibling, 0 replies; 3+ messages in thread
From: Duran, Leo @ 2017-01-20 15:52 UTC (permalink / raw)
  To: 'Dandan Bi', edk2-devel@lists.01.org; +Cc: Singh, Brijesh, Liming Gao

Acked-By: Leo Duran <leo.duran@amd.com>

> -----Original Message-----
> From: Dandan Bi [mailto:dandan.bi@intel.com]
> Sent: Thursday, January 19, 2017 6:54 PM
> To: edk2-devel@lists.01.org
> Cc: Singh, Brijesh <brijesh.singh@amd.com>; Duran, Leo
> <leo.duran@amd.com>; Liming Gao <liming.gao@intel.com>
> Subject: [patch] MdePkg: Avoid Non-Boolean type used as Boolean
> 
> Cc: Brijesh Singh <brijesh.singh@amd.com>
> Cc: Leo Duran  <leo.duran@amd.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Signed-off-by: Leo Duran  <leo.duran@amd.com>
> Reviewed-by: Liming Gao <liming.gao@intel.com>
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-20 15:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-20  0:54 [patch] MdePkg: Avoid Non-Boolean type used as Boolean Dandan Bi
2017-01-20  3:15 ` Gao, Liming
2017-01-20 15:52 ` Duran, Leo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox