From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by mx.groups.io with SMTP id smtpd.web11.7764.1585128819268382172 for ; Wed, 25 Mar 2020 02:33:39 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=eLRQXZJG; spf=pass (domain: linaro.org, ip: 209.85.128.65, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wm1-f65.google.com with SMTP id b12so1543965wmj.3 for ; Wed, 25 Mar 2020 02:33:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GP++ovUWWbsETpIYF1QlIFl2DYafjnjLnTrMcxE8VVw=; b=eLRQXZJG5VBDM87H6E7cBY6HgMOuHrvzYZLha5vFwd5+j+X6waTqXRJGW8QjZAKU9M 5ZTWdVHjVctfHu/sda2PWx2z3is0mQXYEvIUf0t8jRFdDRdKq44ZFgjTVdxU88o0EZDf X/Tj5UDoGxtLekJDxS4poG7JxTaUZcKeZHGihTN8PEt8U1FN1vCjr1gGBti7MVdCbjG5 /U9zPh2TITx7NHLvpLovrXzNOk4x+Gxr1gTqoz9DDxMj9apSkZvtlCNTrJaDxrkeoI3j BEWVcYJONZOYc46i3xEcwbpyIR4w7KbxFdySHL6gJtisSVrINeq5lXY9gsWmZ9alvZma l/Xw== 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:mime-version :content-transfer-encoding; bh=GP++ovUWWbsETpIYF1QlIFl2DYafjnjLnTrMcxE8VVw=; b=RbMbGP/Zq05/hFCGoJPbOIe9iB58cUxr/wjWHXPhNd3uInJntxr7LG9bpUGB/Myr2i w08zTF8Be+YFoAR7HTumxv7uXHpwNfv3lOh4d0oYMM3UI1DRGKQ9xTOnUCX+O1Kpod0q Y9mQw6CwjAyNmMcHrvSYQuHMwXyE5FjLlMPJ6WeL95ER9vFNYGZeyNqLMZ/0SA1ZnVxG 5Hph0NnPOWcypZMRnDuDQ7sS5bO5n6sa/4McrerMxAjc7jy7ul9GwOtgfNUXxTEl2ZAF ewlBS2IyDa8XBjQRz5q3aAOpHJ4r2X2WnnKDZFna3svoYPNmv7Nszp6+tpO2KTarY3g/ Uucg== X-Gm-Message-State: ANhLgQ2pMg5IfjO57rRzxt0A7771c5GmvosrsV2gi1MJFf2fHU3HsF2n J5uF8BG5jR24bEH+RloHEvRbiIdWMcp1Dwqx X-Google-Smtp-Source: ADFU+vtYKVC1gZK9VO0aQPXyfFbII8kPUX1m3gnXBazeI0PKWsMhzLX1VTjK2vx1XA7nv4GOcvShtg== X-Received: by 2002:a05:600c:2316:: with SMTP id 22mr2574513wmo.79.1585128816909; Wed, 25 Mar 2020 02:33:36 -0700 (PDT) Return-Path: Received: from e123331-lin.home (amontpellier-657-1-18-247.w109-210.abo.wanadoo.fr. [109.210.65.247]) by smtp.gmail.com with ESMTPSA id z12sm34444365wrt.27.2020.03.25.02.33.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Mar 2020 02:33:36 -0700 (PDT) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: lersek@redhat.com, Ard Biesheuvel Subject: [PATCH] ArmVirtPkg/PlatformPeiLib: add dummy assignment to work around older GCC Date: Wed, 25 Mar 2020 10:33:34 +0100 Message-Id: <20200325093334.24793-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Older GCC (<= 4.9) fail to infer that Parent is never used unless it has been assigned before, and may throw an error like /work/git/edk2/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c: In function ‘PlatformPeim’: /work/git/edk2/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c:132:24: error: ‘Parent’ may be used uninitialized in this function [-Werror=maybe-uninitialized] RangesProp = fdt_getprop (Base, Parent, "ranges", &RangesLen); Set Parent to 0 at the start of the sequence to work around this. Link: https://bugzilla.tianocore.org/show_bug.cgi?id=2601 Fixes: 82662a3b5f56e974 ("ArmVirtPkg/PlatformPeiLib: discover the TPM base ...") Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c b/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c index 8b5b3dd5dc1c..6c4028e17995 100644 --- a/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c +++ b/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c @@ -77,6 +77,11 @@ PlatformPeim ( TpmBase = 0; + // + // Set Parent to suppress incorrect compiler/analyzer warnings. + // + Parent = 0; + for (Prev = Depth = 0;; Prev = Node) { Node = fdt_next_node (Base, Prev, &Depth); if (Node < 0) { -- 2.17.1