aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-07-27 12:27:46 +0200
committerAndreas Färber <afaerber@suse.de>2013-07-29 21:06:59 +0200
commit0618db44b9da3a2525b414a0928d2b445f897eec (patch)
tree8ac8b58775c766c56cf50278e06a8cc97410cc25 /hw
parent2fa30abadfa2f9f3c47044f677e74988db274d0c (diff)
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>
Diffstat (limited to 'hw')
-rw-r--r--hw/net/stellaris_enet.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/hw/net/stellaris_enet.c b/hw/net/stellaris_enet.c
index 6194e33918..9dd77f7571 100644
--- a/hw/net/stellaris_enet.c
+++ b/hw/net/stellaris_enet.c
@@ -391,11 +391,7 @@ static void stellaris_enet_cleanup(NetClientState *nc)
{
stellaris_enet_state *s = qemu_get_nic_opaque(nc);
- unregister_savevm(DEVICE(s), "stellaris_enet", s);
-
- memory_region_destroy(&s->mmio);
-
- g_free(s);
+ s->nic = NULL;
}
static NetClientInfo net_stellaris_enet_info = {
@@ -427,6 +423,15 @@ static int stellaris_enet_init(SysBusDevice *sbd)
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[] = {
DEFINE_NIC_PROPERTIES(stellaris_enet_state, conf),
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);
k->init = stellaris_enet_init;
+ dc->unrealize = stellaris_enet_unrealize;
dc->props = stellaris_enet_properties;
}