On Sun, 22 May 2022 at 19:19, Mark Cave-Ayland <mark.cave-ayl...@ilande.co.uk> wrote: > > This enables use to expose the register memory region of the I8042_MMIO device > using sysbus_init_mmio(). > > Signed-off-by: Mark Cave-Ayland <mark.cave-ayl...@ilande.co.uk> > --- > hw/input/pckbd.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c > index addd1f058a..c407c082e2 100644 > --- a/hw/input/pckbd.c > +++ b/hw/input/pckbd.c > @@ -683,6 +683,13 @@ static void i8042_mmio_realize(DeviceState *dev, Error > **errp) > "i8042", s->size); > } > > +static void i8042_mmio_init(Object *obj) > +{ > + MMIOKBDState *s = I8042_MMIO(obj); > + > + sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->region); > +}
You don't initialize s->region until your device realize function; you should only call sysbus_init_mmio() after that, so this line belongs in the realize function too. thanks -- PMM