From patchwork Tue May 31 17:48:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcel Apfelbaum X-Patchwork-Id: 9145385 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 05C7560777 for ; Tue, 31 May 2016 17:57:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0AAF2521F for ; Tue, 31 May 2016 17:57:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E596127D17; Tue, 31 May 2016 17:57:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8C93C2521F for ; Tue, 31 May 2016 17:57:03 +0000 (UTC) Received: from localhost ([::1]:37622 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7nuY-0000Bs-C7 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 31 May 2016 13:57:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58999) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7nmj-0001zx-P4 for qemu-devel@nongnu.org; Tue, 31 May 2016 13:48:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7nmd-0005tb-MG for qemu-devel@nongnu.org; Tue, 31 May 2016 13:48:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58706) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7nmd-0005tU-Gs for qemu-devel@nongnu.org; Tue, 31 May 2016 13:48:51 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1AE1B3B70B for ; Tue, 31 May 2016 17:48:51 +0000 (UTC) Received: from work.redhat.com (vpn-200-64.tlv.redhat.com [10.35.200.64]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4VHmcMI018124; Tue, 31 May 2016 13:48:49 -0400 From: Marcel Apfelbaum To: qemu-devel@nongnu.org Date: Tue, 31 May 2016 20:48:35 +0300 Message-Id: <1464716918-29689-5-git-send-email-marcel@redhat.com> In-Reply-To: <1464716918-29689-1-git-send-email-marcel@redhat.com> References: <1464716918-29689-1-git-send-email-marcel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 31 May 2016 17:48:51 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH RFC 4/7] hw/apci: fix pcihp io initialization X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcel@redhat.com, imammedo@redhat.com, pbonzini@redhat.com, ehabkost@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The pm initialization code assigns the pcihp IO base and length to -1 on error, but the later code will assume 0 as invalid value. Fix it initializing the above value to 0 as expected. Signed-off-by: Marcel Apfelbaum --- hw/i386/acpi-build.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 0c329fb..2097c4c 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -124,17 +124,19 @@ static void acpi_get_pm_info(AcpiPmInfo *pm) Object *lpc = ich9_lpc_find(); Object *obj = NULL; QObject *o; + int pcihp_io_len, pcihp_io_base; pm->cpu_hp_io_base = 0; - pm->pcihp_io_base = 0; - pm->pcihp_io_len = 0; if (piix) { obj = piix; pm->cpu_hp_io_base = PIIX4_CPU_HOTPLUG_IO_BASE; - pm->pcihp_io_base = + pcihp_io_base = object_property_get_int(obj, ACPI_PCIHP_IO_BASE_PROP, NULL); - pm->pcihp_io_len = + pcihp_io_len = object_property_get_int(obj, ACPI_PCIHP_IO_LEN_PROP, NULL); + + pm->pcihp_io_base = (pcihp_io_base == -1) ? 0 : pcihp_io_base; + pm->pcihp_io_len = (pcihp_io_len == -1) ? 0 : pcihp_io_len; } if (lpc) { obj = lpc;