Patchwork [v3,15/16] isa: remove useless test in isa_register_ioport()

login
register
mail settings
Submitter Hervé Poussineau
Date Oct. 2, 2011, 4:10 p.m.
Message ID <1317571828-9059-16-git-send-email-hpoussin@reactos.org>
Download mbox | patch
Permalink /patch/117333/
State New
Headers show

Comments

Hervé Poussineau - Oct. 2, 2011, 4:10 p.m.
Use ISA bus from given device instead of global ISA bus

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/isa-bus.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

Patch

diff --git a/hw/isa-bus.c b/hw/isa-bus.c
index 2f9ad24..ab8dbe9 100644
--- a/hw/isa-bus.c
+++ b/hw/isa-bus.c
@@ -117,18 +117,18 @@  void isa_init_ioport(ISADevice *dev, uint16_t ioport)
 
 void isa_register_ioport(ISADevice *dev, MemoryRegion *io, uint16_t start)
 {
-    ISABus *bus = isabus;
+    ISABus *bus = isa_bus_from_device(dev);
 
+    assert(bus == isabus);
     if (!bus || !bus->ops->get_io_space) {
         hw_error("Tried to register I/O port with no isa bus present.");
     }
 
     memory_region_add_subregion(bus->ops->get_io_space(bus), start, io);
-    if (dev != NULL) {
-        assert(dev->nio < ARRAY_SIZE(dev->io));
-        dev->io[dev->nio++] = io;
-        isa_init_ioport_range(dev, start, memory_region_size(io));
-    }
+
+    assert(dev->nio < ARRAY_SIZE(dev->io));
+    dev->io[dev->nio++] = io;
+    isa_init_ioport_range(dev, start, memory_region_size(io));
 }
 
 static int isa_qdev_init(DeviceState *qdev, DeviceInfo *base)