Patchwork [05/14] qdev: remove opts pointer tracking

login
register
mail settings
Submitter Anthony Liguori
Date Sept. 16, 2011, 4 p.m.
Message ID <1316188834-13675-6-git-send-email-aliguori@us.ibm.com>
Download mbox | patch
Permalink /patch/114968/
State New
Headers show

Comments

Anthony Liguori - Sept. 16, 2011, 4 p.m.
This was only used because id's memory was stored in opts.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 hw/qdev.c |    5 ++---
 hw/qdev.h |    1 -
 2 files changed, 2 insertions(+), 4 deletions(-)
Gerd Hoffmann - Sept. 19, 2011, 7:35 a.m.
On 09/16/11 18:00, Anthony Liguori wrote:
> This was only used because id's memory was stored in opts.

No, see reply for patch #4.

cheers,
   Gerd

Patch

diff --git a/hw/qdev.c b/hw/qdev.c
index 41ed872..3096667 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -281,7 +281,6 @@  DeviceState *qdev_device_add(QemuOpts *opts)
         qerror_report(QERR_DEVICE_INIT_FAILED, driver);
         return NULL;
     }
-    qdev->opts = opts;
     return qdev;
 }
 
@@ -410,8 +409,6 @@  void qdev_free(DeviceState *dev)
             vmstate_unregister(dev, dev->info->vmsd, dev);
         if (dev->info->exit)
             dev->info->exit(dev);
-        if (dev->opts)
-            qemu_opts_del(dev->opts);
     }
     QLIST_REMOVE(dev, sibling);
     g_free(dev->id);
@@ -921,6 +918,8 @@  int do_device_add(Monitor *mon, const QDict *qdict, QObject **ret_data)
         qemu_opts_del(opts);
         return -1;
     }
+    qemu_opts_del(opts);
+
     return 0;
 }
 
diff --git a/hw/qdev.h b/hw/qdev.h
index c86736a..d15a47e 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -32,7 +32,6 @@  enum {
 struct DeviceState {
     char *id;
     enum DevState state;
-    QemuOpts *opts;
     int hotplugged;
     DeviceInfo *info;
     BusState *parent_bus;