aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2023-10-19 11:57:59 +0200
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2024-02-15 16:58:46 +0100
commitfc432ba0f58343c8912b80e9056315bb9bd8df92 (patch)
tree9b5137bb5105374776387e3ec52a41a497d355a2 /hw
parent59ae6bcddc3651b55b96c2bf05a6cd4312e46d10 (diff)
downloadqemu-fc432ba0f58343c8912b80e9056315bb9bd8df92.zip
qemu-fc432ba0f58343c8912b80e9056315bb9bd8df92.tar.gz
qemu-fc432ba0f58343c8912b80e9056315bb9bd8df92.tar.bz2
hw/misc/macio: Realize IDE controller before accessing it
We should not wire IRQs on unrealized device. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20240213130341.1793-7-philmd@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/misc/macio/macio.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
index c9f22f8..3f449f9 100644
--- a/hw/misc/macio/macio.c
+++ b/hw/misc/macio/macio.c
@@ -123,14 +123,17 @@ static bool macio_realize_ide(MacIOState *s, MACIOIDEState *ide,
{
SysBusDevice *sbd = SYS_BUS_DEVICE(ide);
- sysbus_connect_irq(sbd, 0, irq0);
- sysbus_connect_irq(sbd, 1, irq1);
qdev_prop_set_uint32(DEVICE(ide), "channel", dmaid);
object_property_set_link(OBJECT(ide), "dbdma", OBJECT(&s->dbdma),
&error_abort);
macio_ide_register_dma(ide);
+ if (!qdev_realize(DEVICE(ide), BUS(&s->macio_bus), errp)) {
+ return false;
+ }
+ sysbus_connect_irq(sbd, 0, irq0);
+ sysbus_connect_irq(sbd, 1, irq1);
- return qdev_realize(DEVICE(ide), BUS(&s->macio_bus), errp);
+ return true;
}
static void macio_oldworld_realize(PCIDevice *d, Error **errp)