Align the bus traversal in pci_change_irq_level to other functions. They use PCIBus:parent_dev to detect the root.
Signed-off-by: Jan Kiszka <jan.kis...@siemens.com> --- hw/pci.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index c1ebdde..893f89c 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -115,13 +115,13 @@ static inline void pci_set_irq_state(PCIDevice *d, int irq_num, int level) static void pci_change_irq_level(PCIDevice *pci_dev, int irq_num, int change) { PCIBus *bus; - for (;;) { + + do { bus = pci_dev->bus; irq_num = bus->map_irq(pci_dev, irq_num); - if (bus->set_irq) - break; pci_dev = bus->parent_dev; - } + } while (pci_dev); + bus->irq_count[irq_num] += change; bus->set_irq(bus->irq_opaque, irq_num, bus->irq_count[irq_num] != 0); } -- 1.7.3.4