From nobody Sat May 4 00:43:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604778055; cv=none; d=zohomail.com; s=zohoarc; b=dvYPmuLrBgUzBJLaY/JD3ls4hF4iwBOZzFYDipbeSzUUVFJhQhVyXM9mcXcpwWyhbu+wwxzULf45xKV3yW+HNIwsVoO4EylGHQuRDe6hSoAeIrUYx3dikuTbuykqp3ZdHbCKiYN3gb4/0Ht6edFicmJLKTV05EtSQ3c7NeTeHQg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604778055; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=AQZWhvSbI5p4N1e0B4bgocntEDGXJm7E/SmoI1MVHIY=; b=l7h3PvDWu+sotJJEvFvlyxyTB+CRQmTzfth6tq8Oj97gPChdYqEwyfFB4T+yXMRyBMFYQTEKFDC4nrU57H39tXMTVXHzHGEVayti9bI0+Dcp9hyld2nEmOZFZrtylR8V49YcIx2GiWXerNHgNAfOaeYpsUBZIx5Q2AklhPFVs28= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 16047780554341021.1352132395059; Sat, 7 Nov 2020 11:40:55 -0800 (PST) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-530-K8y7EJs9PRaKgsDZWjIyJg-1; Sat, 07 Nov 2020 14:40:49 -0500 Received: by mail-wm1-f69.google.com with SMTP id a130so1954798wmf.0 for ; Sat, 07 Nov 2020 11:40:49 -0800 (PST) Return-Path: Return-Path: Received: from localhost.localdomain (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id t7sm7194233wrx.42.2020.11.07.11.40.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Nov 2020 11:40:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604778053; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AQZWhvSbI5p4N1e0B4bgocntEDGXJm7E/SmoI1MVHIY=; b=KGtVIZ4elv0KmRjHxol9SM4Zv/eBbsESWK8uM+lODoAvBLZL/f8pKvm7L2vbsjscG1EnHX v5EfltfSCfYGCPJ4yaPKpyt0rFQo3Ica6P4T9TSA2VROz+Wzef5bfNG8B0Tm1/a3ZtQ6eR ay0PYPOyiMn4ti9b7jMxxnWzxlQAABA= X-MC-Unique: K8y7EJs9PRaKgsDZWjIyJg-1 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=AQZWhvSbI5p4N1e0B4bgocntEDGXJm7E/SmoI1MVHIY=; b=c1stEDrQHN7WGT5l8Mb03qXM6SSZzfwxF8BwXjtkejTms0umSb3LvJTI4r2v0aH0Og vjHNzewLapQZsE40IHcadEH6qowIUtExRbCfH7dCT+jD1dQPf4/XZWAMqRNaZRUeb/sZ +aCduyDjqAsZ/xScklwNJ/lq/qkY3++67bOULfm/dTLMbqau4/wfd3w3rW6jO6BT8WzI y7r+50r4VyrLFzh/cApkryALl3AQY5xY/JS4d46W5rXSijnARA626Vj8hZTMLRWcl4Xm 9lTrK2DK3RedjGDUmThwlOZycnyzfoKYtD8S+yv7nFcvHqvw61S8PqSg19Uv+TDrluFq /GnQ== X-Gm-Message-State: AOAM532qnqTvDo/oLUlttOPNS3wlI1rhmqtUzMpAIux73tHn8gbNp8r2 vZltVP+4kouj4EPaEcfO5oCMSWmILIvvnkCY8zSu1EtGm03uLLpuAdumYTEv/xy3sXvtsQel+6y Xd2o68jtAggBRtw== X-Received: by 2002:adf:f3d2:: with SMTP id g18mr65214wrp.77.1604778048599; Sat, 07 Nov 2020 11:40:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJwDSVt8lASy3Eq82HgII3vyyx1qJw3kYKfbLzY7KY7t3FE3ihO3HV4byqp1ONSTKCXfIYdqJg== X-Received: by 2002:adf:f3d2:: with SMTP id g18mr65196wrp.77.1604778048420; Sat, 07 Nov 2020 11:40:48 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Ani Sinha , Igor Mammedov , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2] hw/i386/acpi-build: Fix maybe-uninitialized error when ACPI hotplug off Date: Sat, 7 Nov 2020 20:40:45 +0100 Message-Id: <20201107194045.438027-1-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) GCC 9.3.0 thinks that 'method' can be left uninitialized. This code is already in the "if (bsel || pcihp_bridge_en)" block statement, but it isn't smart enough to figure it out. Restrict the code to be used only in the "if (bsel || pcihp_bridge_en)" block statement to fix (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=3Dmaybe-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") Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Ani Sinha --- hw/i386/acpi-build.c | 45 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 4f66642d887..1f5c2112452 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -465,34 +465,31 @@ static void build_append_pci_bus_devices(Aml *parent_= scope, PCIBus *bus, */ if (bsel || pcihp_bridge_en) { method =3D aml_method("PCNT", 0, AML_NOTSERIALIZED); - } - /* If bus supports hotplug select it and notify about local events */ - if (bsel) { - uint64_t bsel_val =3D qnum_get_uint(qobject_to(QNum, bsel)); =20 - aml_append(method, aml_store(aml_int(bsel_val), aml_name("BNUM"))); - aml_append(method, - aml_call2("DVNT", aml_name("PCIU"), aml_int(1) /* Device Check= */) - ); - aml_append(method, - aml_call2("DVNT", aml_name("PCID"), aml_int(3)/* Eject Request= */) - ); - } + /* If bus supports hotplug select it and notify about local events= */ + if (bsel) { + uint64_t bsel_val =3D qnum_get_uint(qobject_to(QNum, bsel)); =20 - /* Notify about child bus events in any case */ - if (pcihp_bridge_en) { - QLIST_FOREACH(sec, &bus->child, sibling) { - int32_t devfn =3D sec->parent_dev->devfn; - - if (pci_bus_is_root(sec) || pci_bus_is_express(sec)) { - continue; - } - - aml_append(method, aml_name("^S%.02X.PCNT", devfn)); + aml_append(method, aml_store(aml_int(bsel_val), aml_name("BNUM= "))); + aml_append(method, aml_call2("DVNT", aml_name("PCIU"), + aml_int(1))); /* Device Check */ + aml_append(method, aml_call2("DVNT", aml_name("PCID"), + aml_int(3))); /* Eject Request */ + } + + /* Notify about child bus events in any case */ + if (pcihp_bridge_en) { + QLIST_FOREACH(sec, &bus->child, sibling) { + int32_t devfn =3D sec->parent_dev->devfn; + + if (pci_bus_is_root(sec) || pci_bus_is_express(sec)) { + continue; + } + + aml_append(method, aml_name("^S%.02X.PCNT", devfn)); + } } - } =20 - if (bsel || pcihp_bridge_en) { aml_append(parent_scope, method); } qobject_unref(bsel); --=20 2.26.2