[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 10/18] hw/isa: Ensure isa_register_portio_list() do not get NU
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v3 10/18] hw/isa: Ensure isa_register_portio_list() do not get NULL ISA device |
Date: |
Thu, 2 Mar 2023 23:40:50 +0100 |
Previous commit removed the single call to isa_register_portio_list()
with dev=NULL. To be sure we won't reintroduce such weird (ab)use,
assert dev is non-NULL.
We can now calls isa_address_space_io() to get the device I/O region.
Note we can then remove the NULL check in isa_init_ioport() because
it is only called in 2 places (and is static to this file):
- isa_register_ioport() which first calls isa_address_space_io(),
itself asserting dev is not NULL.
- isa_register_portio_list() which also asserts dev is not NULL
since the previous commit.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/isa/isa-bus.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
index 081bac18ee..9c8224afa5 100644
--- a/hw/isa/isa-bus.c
+++ b/hw/isa/isa-bus.c
@@ -113,7 +113,7 @@ IsaDma *isa_bus_get_dma(ISABus *bus, int nchan)
static inline void isa_init_ioport(ISADevice *dev, uint16_t ioport)
{
- if (dev && (dev->ioport_id == 0 || ioport < dev->ioport_id)) {
+ if (dev->ioport_id == 0 || ioport < dev->ioport_id) {
dev->ioport_id = ioport;
}
}
@@ -129,6 +129,7 @@ int isa_register_portio_list(ISADevice *dev,
const MemoryRegionPortio *pio_start,
void *opaque, const char *name)
{
+ assert(dev);
assert(piolist && !piolist->owner);
if (!isabus) {
--
2.38.1
- [PATCH v3 00/18] hw/ide: Untangle ISA/PCI abuses of ide_init_ioport(), Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 01/18] hw/ide/piix: Expose output IRQ as properties for late object population, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 02/18] hw/ide/piix: Allow using PIIX3-IDE as standalone PCI function, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 03/18] hw/i386/pc_piix: Wire PIIX3 IDE ouput IRQs to ISA bus IRQs 14/15, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 04/18] hw/isa/piix4: Wire PIIX4 IDE ouput IRQs to ISA bus IRQs 14/15, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 05/18] hw/ide: Rename ISA specific ide_init_ioport -> ide_bus_init_ioport_isa, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 06/18] hw/ide/piix: Ensure IDE output IRQs are wired at realization, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 07/18] hw/isa: Deprecate isa_get_irq() in favor of isa_bus_get_irq(), Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 08/18] hw/ide: Introduce generic ide_init_ioport(), Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 09/18] hw/ide/piix: Use generic ide_bus_init_ioport(), Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 10/18] hw/isa: Ensure isa_register_portio_list() do not get NULL ISA device,
Philippe Mathieu-Daudé <=
- [PATCH v3 11/18] hw/isa: Simplify isa_address_space[_io](), Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 12/18] hw/isa: Reduce 'isabus' singleton scope to isa_bus_new(), Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 13/18] exec/ioport: Factor portio_list_register_flush_coalesced() out, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 14/18] exec/ioport: Factor portio_list_register() out, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 15/18] hw/southbridge/piix: Use OBJECT_DECLARE_SIMPLE_TYPE() macro, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 16/18] hw/isa/piix: Batch register QOM types using DEFINE_TYPES() macro, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 17/18] hw/isa/piix: Unify QOM type name of PIIX ISA function, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 18/18] hw/isa/piix: Unify PIIX-ISA QOM type names using qdev aliases, Philippe Mathieu-Daudé, 2023/03/02
- Re: [PATCH v3 00/18] hw/ide: Untangle ISA/PCI abuses of ide_init_ioport(), Michael S. Tsirkin, 2023/03/02
- Re: [PATCH v3 00/18] hw/ide: Untangle ISA/PCI abuses of ide_init_ioport(), David Woodhouse, 2023/03/03