All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bandan Das <bsd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Alex Williamson" <alex.williamson@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>,
	"Markus Armbruster" <armbru@redhat.com>
Subject: [Qemu-devel] [PATCH 1/2 v3] qdev-monitor: set DeviceState opts before calling realize
Date: Mon, 24 Feb 2014 23:34:23 -0500	[thread overview]
Message-ID: <1393302864-11348-2-git-send-email-bsd@redhat.com> (raw)
In-Reply-To: <1393302864-11348-1-git-send-email-bsd@redhat.com>

Setting opts before the realize property is set allows the
following patch to make decisions based on whether the user
specified "rombar". This also avoids having to create a new
tristate property especially for this purpose

Signed-off-by: Bandan Das <bsd@redhat.com>
---
 qdev-monitor.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/qdev-monitor.c b/qdev-monitor.c
index 3a7dc0d..6673e3c 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -548,16 +548,18 @@ DeviceState *qdev_device_add(QemuOpts *opts)
                                   OBJECT(dev), NULL);
         g_free(name);
     }
+
+    dev->opts = opts;
     object_property_set_bool(OBJECT(dev), true, "realized", &err);
     if (err != NULL) {
         qerror_report_err(err);
         error_free(err);
+        dev->opts = NULL;
         object_unparent(OBJECT(dev));
         object_unref(OBJECT(dev));
         qerror_report(QERR_DEVICE_INIT_FAILED, driver);
         return NULL;
     }
-    dev->opts = opts;
     return dev;
 }
 
-- 
1.8.3.1

  reply	other threads:[~2014-02-25  4:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-25  4:34 [Qemu-devel] [PATCH 0/2 v3] vfio: blacklist loading of unstable roms Bandan Das
2014-02-25  4:34 ` Bandan Das [this message]
2014-02-25  7:39   ` [Qemu-devel] [PATCH 1/2 v3] qdev-monitor: set DeviceState opts before calling realize Andreas Färber
2014-02-25  4:34 ` [Qemu-devel] [PATCH 2/2 v3] vfio: blacklist loading of unstable roms Bandan Das
2014-02-25 15:41   ` Alex Williamson
2014-02-25 16:51     ` Bandan Das

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1393302864-11348-2-git-send-email-bsd@redhat.com \
    --to=bsd@redhat.com \
    --cc=afaerber@suse.de \
    --cc=alex.williamson@redhat.com \
    --cc=armbru@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.