From patchwork Fri Apr 9 10:13:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 49816 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 943F6B7CF5 for ; Fri, 9 Apr 2010 20:34:31 +1000 (EST) Received: from localhost ([127.0.0.1]:53864 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O0BUq-0000rT-0b for incoming@patchwork.ozlabs.org; Fri, 09 Apr 2010 06:31:32 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O0BG7-0006vk-10 for qemu-devel@nongnu.org; Fri, 09 Apr 2010 06:16:19 -0400 Received: from [140.186.70.92] (port=46225 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O0BG4-0006sq-9Y for qemu-devel@nongnu.org; Fri, 09 Apr 2010 06:16:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O0BFx-0003pB-Ql for qemu-devel@nongnu.org; Fri, 09 Apr 2010 06:16:16 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:37976) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O0BFx-0003oc-Hn for qemu-devel@nongnu.org; Fri, 09 Apr 2010 06:16:09 -0400 Received: from ps.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with SMTP id 461EE18596; Fri, 9 Apr 2010 19:16:05 +0900 (JST) Received: (nullmailer pid 28821 invoked by uid 1000); Fri, 09 Apr 2010 10:13:24 -0000 Date: Fri, 9 Apr 2010 19:13:24 +0900 From: Isaku Yamahata To: qemu-devel@nongnu.org Message-ID: <20100409101324.GC14603@valinux.co.jp> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Virus-Scanned: clamav-milter 0.95.2 at va-mail.local.valinux.co.jp X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: Blue Swirl , "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH] pci: fix pci_find_bus(). X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When looking down child bus, it looked parent bridge's bus number. It should look child bridge's. Cc: Blue Swirl Cc: "Michael S. Tsirkin" Signed-off-by: Isaku Yamahata --- hw/pci.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 0dbca17..2f6907b 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -1557,9 +1557,9 @@ 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 */ + if (!sec->parent_dev /* pci host bridge */ || (pci_bus_num(sec) <= bus_num && - bus_num <= bus->parent_dev->config[PCI_SUBORDINATE_BUS]) ) { + bus_num <= sec->parent_dev->config[PCI_SUBORDINATE_BUS]) ) { ret = pci_find_bus(sec, bus_num); if (ret) { return ret;