qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: anthony@redhat.com
Cc: "Bandan Das" <bsd@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>,
	qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 3/4] qdev-monitor: set DeviceState opts before calling realize
Date: Wed, 26 Feb 2014 11:26:06 -0700	[thread overview]
Message-ID: <20140226182606.8018.26997.stgit@bling.home> (raw)
In-Reply-To: <20140226182246.8018.81349.stgit@bling.home>

From: Bandan Das <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

Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Bandan Das <bsd@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@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;
 }
 

  parent reply	other threads:[~2014-02-26 18:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-26 18:25 [Qemu-devel] [PULL 0/4] vfio update and fix + pci-assign fix Alex Williamson
2014-02-26 18:25 ` [Qemu-devel] [PULL 1/4] vfio: Fix overrun after readlink() fills buffer completely Alex Williamson
2014-02-26 18:26 ` [Qemu-devel] [PULL 2/4] pci-assign: Fix potential read beyond buffer on -EBUSY Alex Williamson
2014-02-26 18:26 ` Alex Williamson [this message]
2014-02-26 18:26 ` [Qemu-devel] [PULL 4/4] vfio: blacklist loading of unstable roms Alex Williamson
2014-02-26 18:29 ` [Qemu-devel] [PULL 0/4] vfio update and fix + pci-assign fix Alex Williamson
2014-02-27 11:51 ` Peter Maydell

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=20140226182606.8018.26997.stgit@bling.home \
    --to=alex.williamson@redhat.com \
    --cc=afaerber@suse.de \
    --cc=anthony@redhat.com \
    --cc=bsd@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).