Re: [edk2] [PATCH edk2-staging 13/19] IntelUndiPkg/GigUndiDxe: don't take address of cast expression

2019-01-30 Thread Ryszard Knop
Reviewed-by: Ryszard Knop 

On Tue, 2018-11-06 at 18:58 +0100, ard.biesheuvela wrote:
> Taking the address of a cast expression is not permitted in C.
> Instead,
> take the address of the variable, and cast the pointer to the desired
> pointer type.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 
> ---
>  IntelUndiPkg/GigUndiDxe/e1000.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/IntelUndiPkg/GigUndiDxe/e1000.c
> b/IntelUndiPkg/GigUndiDxe/e1000.c
> index 4c9a06b8cf73..28c900e3ad63 100644
> --- a/IntelUndiPkg/GigUndiDxe/e1000.c
> +++ b/IntelUndiPkg/GigUndiDxe/e1000.c
> @@ -1107,7 +1107,7 @@ E1000TxRxConfigure (
>// Set the MemPtr to the high dword of the rx_ring so we can store
> it in RDBAH0.
>// Right shifts do not seem to work with the EFI compiler so we do
> it like this for now.
>MemAddr = (UINT64) (UINTN) GigAdapter->RxRing.PhysicalAddress;
> -  MemPtr  = &((UINT32) MemAddr);
> +  MemPtr  = (UINT32 *)
>MemPtr++;
>E1000_WRITE_REG (>Hw, E1000_RDBAH (0), *MemPtr);
>  
> @@ -1185,7 +1185,7 @@ E1000TxRxConfigure (
>  
>E1000_WRITE_REG (>Hw, E1000_TDBAL (0), (UINT32)
> (UINTN) (GigAdapter->TxRing.PhysicalAddress));
>MemAddr = (UINT64) (UINTN) GigAdapter->TxRing.PhysicalAddress;
> -  MemPtr  = &((UINT32) MemAddr);
> +  MemPtr  = (UINT32 *)
>MemPtr++;
>E1000_WRITE_REG (>Hw, E1000_TDBAH (0), *MemPtr);
>DEBUGPRINT (E1000, ("TdBah0 %X\n", *MemPtr));

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-staging 13/19] IntelUndiPkg/GigUndiDxe: don't take address of cast expression

2018-11-06 Thread Philippe Mathieu-Daudé

On 6/11/18 18:58, Ard Biesheuvel wrote:

Taking the address of a cast expression is not permitted in C. Instead,
take the address of the variable, and cast the pointer to the desired
pointer type.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 


Reviewed-by: Philippe Mathieu-Daudé 


---
  IntelUndiPkg/GigUndiDxe/e1000.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/IntelUndiPkg/GigUndiDxe/e1000.c b/IntelUndiPkg/GigUndiDxe/e1000.c
index 4c9a06b8cf73..28c900e3ad63 100644
--- a/IntelUndiPkg/GigUndiDxe/e1000.c
+++ b/IntelUndiPkg/GigUndiDxe/e1000.c
@@ -1107,7 +1107,7 @@ E1000TxRxConfigure (
// Set the MemPtr to the high dword of the rx_ring so we can store it in 
RDBAH0.
// Right shifts do not seem to work with the EFI compiler so we do it like 
this for now.
MemAddr = (UINT64) (UINTN) GigAdapter->RxRing.PhysicalAddress;
-  MemPtr  = &((UINT32) MemAddr);
+  MemPtr  = (UINT32 *)
MemPtr++;
E1000_WRITE_REG (>Hw, E1000_RDBAH (0), *MemPtr);
  
@@ -1185,7 +1185,7 @@ E1000TxRxConfigure (
  
E1000_WRITE_REG (>Hw, E1000_TDBAL (0), (UINT32) (UINTN) (GigAdapter->TxRing.PhysicalAddress));

MemAddr = (UINT64) (UINTN) GigAdapter->TxRing.PhysicalAddress;
-  MemPtr  = &((UINT32) MemAddr);
+  MemPtr  = (UINT32 *)
MemPtr++;
E1000_WRITE_REG (>Hw, E1000_TDBAH (0), *MemPtr);
DEBUGPRINT (E1000, ("TdBah0 %X\n", *MemPtr));


___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel