|
|
9ae3a8 |
From 69d7d4071c52078ff3040d693e07063de2730925 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
Date: Fri, 17 Jan 2014 17:07:56 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 06/11] qdev-monitor: Inline qdev_init() for device_add
|
|
|
9ae3a8 |
MIME-Version: 1.0
|
|
|
9ae3a8 |
Content-Type: text/plain; charset=UTF-8
|
|
|
9ae3a8 |
Content-Transfer-Encoding: 8bit
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1389978479-30595-7-git-send-email-armbru@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 56793
|
|
|
9ae3a8 |
O-Subject: [PATCH 7.0 qemu-kvm 6/9] qdev-monitor: Inline qdev_init() for device_add
|
|
|
9ae3a8 |
Bugzilla: 669524
|
|
|
9ae3a8 |
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Andreas Färber <afaerber@suse.de>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
For historic reasons, qdev_init() unparents the device on failure.
|
|
|
9ae3a8 |
Inline this to make the error paths clearer and consistent.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Andreas Färber <afaerber@suse.de>
|
|
|
9ae3a8 |
(cherry picked from commit 852e2c5008563692a8868260480e76b95bb9018c)
|
|
|
9ae3a8 |
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
qdev-monitor.c | 7 ++++++-
|
|
|
9ae3a8 |
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
qdev-monitor.c | 7 ++++++-
|
|
|
9ae3a8 |
1 files changed, 6 insertions(+), 1 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/qdev-monitor.c b/qdev-monitor.c
|
|
|
9ae3a8 |
index 464e7bd..eb05b4c 100644
|
|
|
9ae3a8 |
--- a/qdev-monitor.c
|
|
|
9ae3a8 |
+++ b/qdev-monitor.c
|
|
|
9ae3a8 |
@@ -459,6 +459,7 @@ DeviceState *qdev_device_add(QemuOpts *opts)
|
|
|
9ae3a8 |
const char *driver, *path, *id;
|
|
|
9ae3a8 |
DeviceState *dev;
|
|
|
9ae3a8 |
BusState *bus = NULL;
|
|
|
9ae3a8 |
+ Error *err = NULL;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
driver = qemu_opt_get(opts, "driver");
|
|
|
9ae3a8 |
if (!driver) {
|
|
|
9ae3a8 |
@@ -541,7 +542,11 @@ DeviceState *qdev_device_add(QemuOpts *opts)
|
|
|
9ae3a8 |
OBJECT(dev), NULL);
|
|
|
9ae3a8 |
g_free(name);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
- if (qdev_init(dev) < 0) {
|
|
|
9ae3a8 |
+ object_property_set_bool(OBJECT(dev), true, "realized", &err;;
|
|
|
9ae3a8 |
+ if (err != NULL) {
|
|
|
9ae3a8 |
+ qerror_report_err(err);
|
|
|
9ae3a8 |
+ error_free(err);
|
|
|
9ae3a8 |
+ object_unparent(OBJECT(dev));
|
|
|
9ae3a8 |
object_unref(OBJECT(dev));
|
|
|
9ae3a8 |
qerror_report(QERR_DEVICE_INIT_FAILED, driver);
|
|
|
9ae3a8 |
return NULL;
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|