From patchwork Sat Nov 7 17:22:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ani Sinha X-Patchwork-Id: 11889085 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F1EA514B4 for ; Sat, 7 Nov 2020 17:22:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 67BF120878 for ; Sat, 7 Nov 2020 17:22:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=anisinha-ca.20150623.gappssmtp.com header.i=@anisinha-ca.20150623.gappssmtp.com header.b="BR9sfV19" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 67BF120878 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=anisinha.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:38386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kbRvQ-0006O1-1b for patchwork-qemu-devel@patchwork.kernel.org; Sat, 07 Nov 2020 12:22:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39268) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kbRuy-0005ry-Ot for qemu-devel@nongnu.org; Sat, 07 Nov 2020 12:22:24 -0500 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:38962) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kbRuw-0002C3-Vy for qemu-devel@nongnu.org; Sat, 07 Nov 2020 12:22:24 -0500 Received: by mail-pg1-x52b.google.com with SMTP id i7so3521694pgh.6 for ; Sat, 07 Nov 2020 09:22:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anisinha-ca.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TXyCFy+ftKKMW+sGSwFyxzOZFwwOs3gESr9R+zrqPGU=; b=BR9sfV19zOEb1atQz2ic86U93euW8rRmsaAB1BzTAPKC+RJqcU+zMy/0cGjXehaggc CZQwMnLAw+f0fFOJ7hPCEokkOQnpKa4PwHQ1R3kHVBBAAJ8T1HZ8WTCKKowH6SYBSCx2 F/X9CuXnvD8u54yQ95Pn6uhYNtONhY0xoMmPSLuySSIfmrI5olQ5xPKtXJ4zIwZUFZsF FUe+/3aNkzpDK4mASpVv57CKq5SLv84ISq7YFzGMEm00pM0zFDEBpANR1KZ63tExw/+z v0TiERxyBrlXGygTB4zjkAb+gBbXtOHycG99rYR2WAJqHCf9WFgkxzl5gxJURHomOUCM wZRA== 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=TXyCFy+ftKKMW+sGSwFyxzOZFwwOs3gESr9R+zrqPGU=; b=T7wKP042V6TQt+w3kEUWAm9mNa05XHNKwnD25hRU1bn5y5nJZmPrYvTKRm//zFjKix VSIECtTVVEvJThelOm+B0M3p0AZA/TzVGwG2EZ2jG/k6/1TNyCJKLWOipyAqXaxtUbo3 GjCL/44zmBud+UGERuAwK4ANYkeEJYcy/HOjFbLJG6zjypgzaC+cFHpudEDVXHT8g6pE IKuoQZiLKFuAntBLEew3v9KAF70oPqO3jhjdoj9ETGp+ByKXsEGmbFlMpfaiePcUtSt1 xq7QOMb+MvoDHW76gQSsP+dHEknhnP0PZWUaGqUZrhuijT8zQ8nuu40YAhu/Abhv6fP7 IevQ== X-Gm-Message-State: AOAM533Z32oCAKNsKmD+FBjBk+Tbt1ZFFpNIcvRwd5XD9Pv9MrgUazOI svYf61h/RjeoDV3xYpgiRUbMHLDa9BK4NA== X-Google-Smtp-Source: ABdhPJwVtoN13jnLr3NwNWjOSuALHa/A9z96hsNLF7jGSzyKeOtJtDJbntwtN5Og9MTXePEZSHizYg== X-Received: by 2002:a63:5b63:: with SMTP id l35mr6608756pgm.70.1604769740999; Sat, 07 Nov 2020 09:22:20 -0800 (PST) Received: from localhost.localdomain ([115.96.136.129]) by smtp.googlemail.com with ESMTPSA id d68sm6444914pfc.135.2020.11.07.09.22.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Nov 2020 09:22:20 -0800 (PST) From: Ani Sinha To: qemu-devel@nongnu.org Subject: [PATCH-for-5.2 v2] acpi-build: Fix maybe-uninitialized warning when ACPI hotplug is off Date: Sat, 7 Nov 2020 22:52:11 +0530 Message-Id: <20201107172211.117990-1-ani@anisinha.ca> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::52b; envelope-from=ani@anisinha.ca; helo=mail-pg1-x52b.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , mst@redhat.com, Paolo Bonzini , Ani Sinha , Igor Mammedov , philmd@redhat.com, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" This fixes the following warning (gcc 9.3.0 on Ubuntu): ../hw/i386/acpi-build.c: In function 'build_append_pci_bus_devices': ../hw/i386/acpi-build.c:496:9: error: 'method' may be used uninitialized in this function [-Werror=maybe-uninitialized] 496 | aml_append(parent_scope, method); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors Fixes: df4008c9c59 ("piix4: don't reserve hw resources when hotplug is off globally") Reported-by: Philippe Mathieu-Daudé Signed-off-by: Ani Sinha --- hw/i386/acpi-build.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 4f66642d88..431f5ba247 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -349,7 +349,7 @@ static void build_append_pcihp_notify_entry(Aml *method, int slot) static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus, bool pcihp_bridge_en) { - Aml *dev, *notify_method = NULL, *method; + Aml *dev, *notify_method = NULL, *method = NULL; QObject *bsel; PCIBus *sec; int i; @@ -463,6 +463,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus, * Add this method for root bus only when hotplug is enabled since DSDT * expects it. */ + method = NULL; if (bsel || pcihp_bridge_en) { method = aml_method("PCNT", 0, AML_NOTSERIALIZED); } @@ -492,7 +493,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus, } } - if (bsel || pcihp_bridge_en) { + if (method) { aml_append(parent_scope, method); } qobject_unref(bsel);