From patchwork Tue Nov 6 17:58:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 150315 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp4192556ljp; Tue, 6 Nov 2018 09:59:38 -0800 (PST) X-Google-Smtp-Source: AJdET5cKowcoocCXg0rsiXIFTdv4HivBAxzGFuaiXWLuBLswn9/eMT3E8/Vmw1VFcxelRS9px61f X-Received: by 2002:a63:db02:: with SMTP id e2mr15000899pgg.419.1541527178251; Tue, 06 Nov 2018 09:59:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541527178; cv=none; d=google.com; s=arc-20160816; b=FxVXh4PTWyxnG5RBIscTc5W2PdzYnLlcjq9sjJRRcLQYQoWjD5Wv6yWcnOa0GxyCjR twlFLMI+QWgdkZN4T4CnrJ2a9KoPzYFDXIddXQW67HXIL0ZrOHVdu0c59F+CHBhnd4/h f1/U/EgTZk6h2CfmxcCyZyLBSRy00pJv0kwV+l5kcsEYXS9IKS4YxxFJT3XNAK6qo6+z fnaw5jRd75fVOY+e9H6hwcndWZ3XMu3KXmhetwutC5apA6Kk2tVfNwicwxL/05biIfCk WugUoI3rW/VhuI+1Rq50yVvcCY2I+z9oh5K40R7NpBcx8waYpYpO9c8+OU1zBEkflVsF 8lKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=hFFd8YkmvxGY99ZW1hJa3Cl540qolYsUhik/TTRGxRg=; b=doXU/q3XwwmR8fTUYiKyafBPND0RSw8qLYGrQq/PqQFxpyJx1W28kyp4Ji774vbtOC T3iqP0VLBhRZ6v/B3XVDxCM20N5XFAO7+HltoERLCt6huvsYSfIUcyfcfckzRjlyoSuj 1Y6ZTMBY2tXdqkoIhg023dQZPLSz4qqeN6tORj9DYoGWsmeMhP+RF0vkAoILb40ycmo/ EGzqc1TZzdGqF7D8bNPCFk4CuTy6t24MqYgMg/9SaEs5eyOTDMO3xxFcofOrV8iPiVG6 zCwu/XKtqtkUaBPfRqe8C0XSIzwAs504HTlkNtoorWRVE8nz8PtHY4rAAx0e9xHjMdCc YRNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="aWR/qQOw"; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id 16si22173914pgh.58.2018.11.06.09.59.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 09:59:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="aWR/qQOw"; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C852B2118C516; Tue, 6 Nov 2018 09:59:09 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::444; helo=mail-wr1-x444.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 09F8621131DCF for ; Tue, 6 Nov 2018 09:59:08 -0800 (PST) Received: by mail-wr1-x444.google.com with SMTP id y3-v6so14263033wrh.10 for ; Tue, 06 Nov 2018 09:59:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kfAlwte03sNvPk5cgq3Y0fCYXpgLbvJxTdtNLfht1kA=; b=aWR/qQOwNKWzkdHf5U8YuMPa50aeAhHIl7G5jlaMdzwWqyF68+x4+SxFR42BcEuZhl WGPOO0VbLx5PdqnLkKPt+h/1zT6X/LnWQRmi1C53FO6zmCC3alhp2cmCvyufJO8j7ggO EQToGyKr35TlDkn09SYRH03RCXHQfMboVTAlo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kfAlwte03sNvPk5cgq3Y0fCYXpgLbvJxTdtNLfht1kA=; b=TEonoWiKbzry/gWCsgqouebBd3AH6l59JfmlVu447GLTkkWKxYxSxzqYYbJH+EnpY0 OumSG7Cg9kMth9eG0THuB3RjuYYKdk5tPK0MCbpzhTg7lYrFp3wXCkeA3cjYOEbIhK2w zTdiQvPNoIUd8Grm+ia71fwBN3eWAvp2ewb91etdiEynQ63Qz/JecQgPb0xacmO3AjBK lf+ZeY37+fn0BQ0NYigiBDnwKGdOebmNdXT1j4OWYVsYfZHkUHdp7zJTQCmcj0nQzumJ qXXOv4Q7imkAnOaHAthDjrg0R+LxO5fQyDYRBEDnC70UM8/5d+4TaAo73Gp2K+gn4DA6 z+Pw== X-Gm-Message-State: AGRZ1gKrf/wSf5RZMnDTm/W2JXIzVXV7BvRGqx2MFFbnrGFciqXywo1E q9Hkip1sGQeUiTsC8upG8LeVFgxVghw= X-Received: by 2002:adf:a409:: with SMTP id d9-v6mr23924515wra.190.1541527146145; Tue, 06 Nov 2018 09:59:06 -0800 (PST) Received: from localhost.localdomain (laubervilliers-657-1-83-120.w92-154.abo.wanadoo.fr. [92.154.90.120]) by smtp.gmail.com with ESMTPSA id 134-v6sm2971522wmp.6.2018.11.06.09.59.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 09:59:05 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Tue, 6 Nov 2018 18:58:27 +0100 Message-Id: <20181106175833.26964-14-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181106175833.26964-1-ard.biesheuvel@linaro.org> References: <20181106175833.26964-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [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: , Cc: michael.d.kinney@intel.com, eric.jin@intel.com Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.19.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Ryszard Knop 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));