From patchwork Mon Nov 16 12:24:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 324382 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp3275906ils; Mon, 16 Nov 2020 04:29:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJyg49af0bkT1dqEJ0K4IzLhPCG775uS4bIgqbC20SreJ4VpXN4lYD0/cJ0ZlUngkku+drKm X-Received: by 2002:a25:bc42:: with SMTP id d2mr21333557ybk.461.1605529774923; Mon, 16 Nov 2020 04:29:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605529774; cv=none; d=google.com; s=arc-20160816; b=DfoOTV+vR+Ob8OTclwFJFLzeEJ9NNo8tKDuSxNJDrcPTdFv5YFs0cE1qXfqmAxorI9 nOf9rAU3jfycxbOuimznjIVb/QXUDdkxH0k0KJgsTtrg6WMToAaX4lSggGpUzF4VaBKX jLD9rTcGGV/H5Nz5tj1TYUvGoOpejnD1EwjT0ofvM5FbnpqSzyIw7rphJBDKThYYXhgk YCaYxF2z/35DZ1IRa9jnEZvUmG+V9z0dR3Knd6aBavoz31xLphxYkI6ij6QieRn8vIus bXVCHP+yXj9xsUmKExriiFEP/xwctNDgwZOfCyNShw5QwcKQ3wpu05g1YjYlv3TLwV+8 qN8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=OUmMobUpj5JXbp+PLsouZvAX3qQPm1cOEtWl7FIgmgA=; b=pPF5UIJWIJXcuwjAKvQyB/apynZvScjKpLZE9j5BUd6Y4E7OiNOWtTVryD2kUwAN+A m/NtGvByInfEPqtp3xjbDZ5Tp6GScm+k3gLvI2WIt/FVAohvAXXUCOUIINolhZzod6ms ti+UOYVVGC5PhonkFbkEY2X5LgEsZBHJmA+95nhR6V7SkNxtl/QhoOm80OkZHMEM3bV2 /8tO+o3WddaqcimIVJf1PWUhKf2Nk91rjgXMs0uKHLBrQTMqftVY5hjIWXMOjO9Zldcn vn9cpBBI6RGD2ebdiiivUkKuStERvYpS6NHjeQV0wr7Z/0tuKJ918XoC51K6aOxs/X53 PaXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=yJAFf4qq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s203si18169783ybb.453.2020.11.16.04.29.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Nov 2020 04:29:34 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=yJAFf4qq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36672 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1keddW-00070o-Cr for patch@linaro.org; Mon, 16 Nov 2020 07:29:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58080) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kedYo-0001vg-EI for qemu-devel@nongnu.org; Mon, 16 Nov 2020 07:24:42 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:34017) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kedYm-0003CC-D8 for qemu-devel@nongnu.org; Mon, 16 Nov 2020 07:24:42 -0500 Received: by mail-wr1-x435.google.com with SMTP id r17so18509407wrw.1 for ; Mon, 16 Nov 2020 04:24:39 -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=OUmMobUpj5JXbp+PLsouZvAX3qQPm1cOEtWl7FIgmgA=; b=yJAFf4qqdOvgvwzFs6bvcMu9vnX9hnsmc+UxrpNTIqugeXjRxj2R3b1IAPlTZGxcFL Qpf7+RYD0ZghQjwQe4P9s+0M1GFAfpy9LYQZo41QrCCcexPE7uitTHuCVJ/mFSISgO7k gTFp/xUuZD6nseUlaanCfsIL5fRvKiGGuYYxAnzOPiL9/uIpN014FrUE38gT9Zxroe1Z z6giYXLU5K8OKEuSe9gHCoK4qe1h7eLfo087A9sHPVjiIHFjMXv9dKq1j9YZZm5Vbfxg hPKm8gO1Bt+j/ALLuPOnZ2mdST3S08i82bpH4wPZEwK8+Af7oYUp0sEDP9MuaRP2G6jS ry+A== 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=OUmMobUpj5JXbp+PLsouZvAX3qQPm1cOEtWl7FIgmgA=; b=ZK/bheaMPxQPhpBivovRHXlz738egVry4MAzMRkA+88PL9ncwla7hSS3/QwCBvl73V 3ioZcMTD9jlgUx2KfucEufjeXlDaN5KVCsC2IyadYbbwoPIYE7Q0t1jKucMRltuKkJTj dvVjFFBqFJbg22CR3sNGlxzX/9+j51Zky4URXatBuq6QcNw8EtOoZK610mXxGyF0vAFe lCpCZp06eP6NOFO3rTA3CxGho7C2uzrroF3l4Kid4gnPuc15yBCSn2vzmm4JCu5+O/2u ZiSb3lNckxuuZBnVbxmNHWafd0XyJYMpFzH0E4HXbzY7ZbA1uvee2afMFw62T7fuqLIs xsyw== X-Gm-Message-State: AOAM531vK8nwpGmbyakcGZ9qFxW8bveRzHd3rm0qsq7OOmjV3Azah1rq u1H1kmdRwr6+QwgHeg6vioEXnm2JRiyyDA== X-Received: by 2002:a5d:6992:: with SMTP id g18mr18880546wru.362.1605529478899; Mon, 16 Nov 2020 04:24:38 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id z3sm21650510wrw.87.2020.11.16.04.24.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2020 04:24:27 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 6F1551FF93; Mon, 16 Nov 2020 12:24:18 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 7/9] hw/i386/acpi-build: Fix maybe-uninitialized error when ACPI hotplug off Date: Mon, 16 Nov 2020 12:24:15 +0000 Message-Id: <20201116122417.28346-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201116122417.28346-1-alex.bennee@linaro.org> References: <20201116122417.28346-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x435.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 , "Michael S. Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , qemu-devel@nongnu.org, Igor Mammedov , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé 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=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") Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée Reviewed-by: Igor Mammedov Message-Id: <20201108204535.2319870-4-philmd@redhat.com> Message-Id: <20201110192316.26397-8-alex.bennee@linaro.org> -- 2.20.1 diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 4f66642d88..1f5c211245 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 = aml_method("PCNT", 0, AML_NOTSERIALIZED); - } - /* If bus supports hotplug select it and notify about local events */ - if (bsel) { - uint64_t bsel_val = qnum_get_uint(qobject_to(QNum, bsel)); - 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 = qnum_get_uint(qobject_to(QNum, bsel)); - /* Notify about child bus events in any case */ - if (pcihp_bridge_en) { - QLIST_FOREACH(sec, &bus->child, sibling) { - int32_t devfn = sec->parent_dev->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 */ + } - if (pci_bus_is_root(sec) || pci_bus_is_express(sec)) { - continue; - } + /* Notify about child bus events in any case */ + if (pcihp_bridge_en) { + QLIST_FOREACH(sec, &bus->child, sibling) { + int32_t devfn = 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_name("^S%.02X.PCNT", devfn)); + } } - } - if (bsel || pcihp_bridge_en) { aml_append(parent_scope, method); } qobject_unref(bsel);