Message ID | 20230302224058.43315-12-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | hw/ide: Untangle ISA/PCI abuses of ide_init_ioport() | expand |
On 02/03/2023 22:40, Philippe Mathieu-Daudé wrote: > We don't have any caller passing a NULL device argument, > so we can simplify, avoiding to access the global 'isabus'. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > hw/isa/isa-bus.c | 14 ++++---------- > 1 file changed, 4 insertions(+), 10 deletions(-) > > diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c > index 9c8224afa5..3036341d3b 100644 > --- a/hw/isa/isa-bus.c > +++ b/hw/isa/isa-bus.c > @@ -252,20 +252,14 @@ static char *isabus_get_fw_dev_path(DeviceState *dev) > > MemoryRegion *isa_address_space(ISADevice *dev) > { > - if (dev) { > - return isa_bus_from_device(dev)->address_space; > - } > - > - return isabus->address_space; > + assert(dev); > + return isa_bus_from_device(dev)->address_space; > } > > MemoryRegion *isa_address_space_io(ISADevice *dev) > { > - if (dev) { > - return isa_bus_from_device(dev)->address_space_io; > - } > - > - return isabus->address_space_io; > + assert(dev); > + return isa_bus_from_device(dev)->address_space_io; > } > > type_init(isabus_register_types) Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> ATB, Mark.
diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index 9c8224afa5..3036341d3b 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -252,20 +252,14 @@ static char *isabus_get_fw_dev_path(DeviceState *dev) MemoryRegion *isa_address_space(ISADevice *dev) { - if (dev) { - return isa_bus_from_device(dev)->address_space; - } - - return isabus->address_space; + assert(dev); + return isa_bus_from_device(dev)->address_space; } MemoryRegion *isa_address_space_io(ISADevice *dev) { - if (dev) { - return isa_bus_from_device(dev)->address_space_io; - } - - return isabus->address_space_io; + assert(dev); + return isa_bus_from_device(dev)->address_space_io; } type_init(isabus_register_types)
We don't have any caller passing a NULL device argument, so we can simplify, avoiding to access the global 'isabus'. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/isa/isa-bus.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)