Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O0Nyt-0000XZ-DP for qemu-devel@nongnu.org; Fri, 09 Apr 2010 19:51:23 -0400 Received: from [140.186.70.92] (port=50909 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O0Nyr-0000XQ-My for qemu-devel@nongnu.org; Fri, 09 Apr 2010 19:51:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O0Nyp-0006aD-Si for qemu-devel@nongnu.org; Fri, 09 Apr 2010 19:51:21 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:46295) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O0Nyp-0006Zl-GA for qemu-devel@nongnu.org; Fri, 09 Apr 2010 19:51:19 -0400 Date: Sat, 10 Apr 2010 08:48:35 +0900 From: Isaku Yamahata Message-ID: <20100409234835.GA1232@valinux.co.jp> References: <20100409101324.GC14603@valinux.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100409101324.GC14603@valinux.co.jp> Subject: [Qemu-devel] Re: [PATCH] pci: fix pci_find_bus(). List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Blue Swirl , "Michael S. Tsirkin" Oh I sent out the wrong one. This is the correct one. Sorry for noise. >From 370c23c837070f78ca5715f032eacbf6747d42fb Mon Sep 17 00:00:00 2001 Message-Id: <370c23c837070f78ca5715f032eacbf6747d42fb.1270856742.git.yamahata@valinux.co.jp> In-Reply-To: References: From: Isaku Yamahata Date: Fri, 9 Apr 2010 19:09:35 +0900 Subject: [PATCH] pci: fix pci_find_bus(). When looking down child bus, it should look parent bridge's bus number, not child bus's. Cc: Blue Swirl Cc: "Michael S. Tsirkin" Signed-off-by: Isaku Yamahata --- hw/pci.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 0dbca17..b6e6bbe 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -1556,10 +1556,10 @@ PCIBus *pci_find_bus(PCIBus *bus, int bus_num) } /* try child bus */ - QLIST_FOREACH(sec, &bus->child, sibling) { - if (!bus->parent_dev /* pci host bridge */ - || (pci_bus_num(sec) <= bus_num && - bus_num <= bus->parent_dev->config[PCI_SUBORDINATE_BUS]) ) { + if (!bus->parent_dev /* pci host bridge */ + || (pci_bus_num(bus) <= bus_num && + bus_num <= bus->parent_dev->config[PCI_SUBORDINATE_BUS])) { + QLIST_FOREACH(sec, &bus->child, sibling) { ret = pci_find_bus(sec, bus_num); if (ret) { return ret; -- 1.6.6.1 -- yamahata