From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=ryszard.knop@linux.intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B75C0211BFCB5 for ; Wed, 30 Jan 2019 05:41:28 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jan 2019 05:41:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,540,1539673200"; d="scan'208";a="295669291" Received: from linux.intel.com ([10.54.29.200]) by orsmga005.jf.intel.com with ESMTP; 30 Jan 2019 05:41:28 -0800 Received: from torii (torii.igk.intel.com [10.102.24.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id 4874558042B; Wed, 30 Jan 2019 05:41:26 -0800 (PST) Message-ID: From: Ryszard Knop To: Ard Biesheuvel , edk2-devel@lists.01.org Cc: kamil.kacperski@intel.com, eric.jin@intel.com, pawel.orlowski@intel.com, michael.d.kinney@intel.com, harry.l.hsiung@intel.com Date: Wed, 30 Jan 2019 14:41:24 +0100 In-Reply-To: <20181106175833.26964-14-ard.biesheuvel@linaro.org> References: <20181106175833.26964-1-ard.biesheuvel@linaro.org> <20181106175833.26964-14-ard.biesheuvel@linaro.org> Organization: Intel Corporation User-Agent: Evolution 3.30.4 Mime-Version: 1.0 Subject: Re: [PATCH edk2-staging 13/19] IntelUndiPkg/GigUndiDxe: don't take address of cast expression X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jan 2019 13:41:29 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit 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 *)&MemAddr; > MemPtr++; > E1000_WRITE_REG (&GigAdapter->Hw, E1000_RDBAH (0), *MemPtr); > > @@ -1185,7 +1185,7 @@ E1000TxRxConfigure ( > > E1000_WRITE_REG (&GigAdapter->Hw, E1000_TDBAL (0), (UINT32) > (UINTN) (GigAdapter->TxRing.PhysicalAddress)); > MemAddr = (UINT64) (UINTN) GigAdapter->TxRing.PhysicalAddress; > - MemPtr = &((UINT32) MemAddr); > + MemPtr = (UINT32 *)&MemAddr; > MemPtr++; > E1000_WRITE_REG (&GigAdapter->Hw, E1000_TDBAH (0), *MemPtr); > DEBUGPRINT (E1000, ("TdBah0 %X\n", *MemPtr));