Skip to content

Commit

Permalink
hw/misc/macio: Realize IDE controller before accessing it
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
philmd committed Feb 15, 2024
1 parent 59ae6bc commit fc432ba
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions hw/misc/macio/macio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fc432ba

Please sign in to comment.