[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 6/7] hw/isa: Assert isa_register_portio_list() gets non-NULL ISA
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 6/7] hw/isa: Assert isa_register_portio_list() gets non-NULL ISA device |
Date: |
Wed, 8 Feb 2023 01:07:42 +0100 |
The 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,
add an assertion.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/isa/isa-bus.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
index 95fc1ba5f7..3d1996c115 100644
--- a/hw/isa/isa-bus.c
+++ b/hw/isa/isa-bus.c
@@ -107,7 +107,7 @@ IsaDma *isa_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;
}
}
@@ -123,6 +123,8 @@ int isa_register_portio_list(ISADevice *dev,
const MemoryRegionPortio *pio_start,
void *opaque, const char *name)
{
+ assert(dev);
+
if (!isabus) {
return -ENODEV;
}
--
2.38.1
[PATCH 5/7] hw/ide/piix: Use generic ide_init_ioport(), Philippe Mathieu-Daudé, 2023/02/07
[PATCH 4/7] hw/ide: Introduce generic ide_init_ioport(), Philippe Mathieu-Daudé, 2023/02/07