From patchwork Sun Oct 15 04:24:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 825928 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yF7fm0YnRz9sPs for ; Sun, 15 Oct 2017 15:25:31 +1100 (AEDT) Received: from localhost ([::1]:56120 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e3aUQ-0007me-HJ for incoming@patchwork.ozlabs.org; Sun, 15 Oct 2017 00:25:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59169) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e3aU4-0007mY-Gl for qemu-devel@nongnu.org; Sun, 15 Oct 2017 00:25:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e3aU1-00015o-DL for qemu-devel@nongnu.org; Sun, 15 Oct 2017 00:25:04 -0400 Received: from ozlabs.ru ([107.173.13.209]:52658) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e3aU1-00015i-7N for qemu-devel@nongnu.org; Sun, 15 Oct 2017 00:25:01 -0400 Received: from vpl1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 85A983A60009; Sun, 15 Oct 2017 00:23:46 -0400 (EDT) From: Alexey Kardashevskiy To: qemu-devel@nongnu.org Date: Sun, 15 Oct 2017 15:24:52 +1100 Message-Id: <20171015042452.31714-1-aik@ozlabs.ru> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 107.173.13.209 Subject: [Qemu-devel] [PATCH qemu v2 REPOST] pci: Initialize pci_dev->name before use 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: Alexey Kardashevskiy , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This moves pci_dev->name initialization earlier so pci_dev->bus_master_as could get a name instead of an empty string. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Alexey Kardashevskiy Reviewed-by: Peter Xu --- Changes: v2: * fixed mistype in the commit log * added "rb" --- hw/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 1e6fb88eba..05c5f75ef0 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1020,6 +1020,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus, pci_dev->devfn = devfn; pci_dev->requester_id_cache = pci_req_id_cache_get(pci_dev); + pstrcpy(pci_dev->name, sizeof(pci_dev->name), name); memory_region_init(&pci_dev->bus_master_container_region, OBJECT(pci_dev), "bus master container", UINT64_MAX); @@ -1029,7 +1030,6 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus, if (qdev_hotplug) { pci_init_bus_master(pci_dev); } - pstrcpy(pci_dev->name, sizeof(pci_dev->name), name); pci_dev->irq_state = 0; pci_config_alloc(pci_dev);