stellaris_enet: Fix NetClientInfo::cleanup
Drop freeing stellaris_enet_state - that is done by QOM later on unref. Both MemoryRegion init and savevm registration happen in SysBusDevice initfn currently, so move them into an unrealizefn for now. Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
2fa30abadf
commit
0618db44b9
|
@ -391,11 +391,7 @@ static void stellaris_enet_cleanup(NetClientState *nc)
|
||||||
{
|
{
|
||||||
stellaris_enet_state *s = qemu_get_nic_opaque(nc);
|
stellaris_enet_state *s = qemu_get_nic_opaque(nc);
|
||||||
|
|
||||||
unregister_savevm(DEVICE(s), "stellaris_enet", s);
|
s->nic = NULL;
|
||||||
|
|
||||||
memory_region_destroy(&s->mmio);
|
|
||||||
|
|
||||||
g_free(s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static NetClientInfo net_stellaris_enet_info = {
|
static NetClientInfo net_stellaris_enet_info = {
|
||||||
|
@ -427,6 +423,15 @@ static int stellaris_enet_init(SysBusDevice *sbd)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void stellaris_enet_unrealize(DeviceState *dev, Error **errp)
|
||||||
|
{
|
||||||
|
stellaris_enet_state *s = STELLARIS_ENET(dev);
|
||||||
|
|
||||||
|
unregister_savevm(DEVICE(s), "stellaris_enet", s);
|
||||||
|
|
||||||
|
memory_region_destroy(&s->mmio);
|
||||||
|
}
|
||||||
|
|
||||||
static Property stellaris_enet_properties[] = {
|
static Property stellaris_enet_properties[] = {
|
||||||
DEFINE_NIC_PROPERTIES(stellaris_enet_state, conf),
|
DEFINE_NIC_PROPERTIES(stellaris_enet_state, conf),
|
||||||
DEFINE_PROP_END_OF_LIST(),
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
|
@ -438,6 +443,7 @@ static void stellaris_enet_class_init(ObjectClass *klass, void *data)
|
||||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
||||||
|
|
||||||
k->init = stellaris_enet_init;
|
k->init = stellaris_enet_init;
|
||||||
|
dc->unrealize = stellaris_enet_unrealize;
|
||||||
dc->props = stellaris_enet_properties;
|
dc->props = stellaris_enet_properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue