mirror of
https://git.proxmox.com/git/qemu
synced 2025-06-14 10:03:06 +00:00
qdev-monitor: Avoid qdev as variable name
Prepares for bringing error cleanup code into canonical QOM form. Includes a whitespace removal after curly brace by Stefan. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
02a5c4c974
commit
2bcb0c62f6
@ -456,7 +456,7 @@ DeviceState *qdev_device_add(QemuOpts *opts)
|
|||||||
ObjectClass *oc;
|
ObjectClass *oc;
|
||||||
DeviceClass *dc;
|
DeviceClass *dc;
|
||||||
const char *driver, *path, *id;
|
const char *driver, *path, *id;
|
||||||
DeviceState *qdev;
|
DeviceState *dev;
|
||||||
BusState *bus = NULL;
|
BusState *bus = NULL;
|
||||||
|
|
||||||
driver = qemu_opt_get(opts, "driver");
|
driver = qemu_opt_get(opts, "driver");
|
||||||
@ -515,38 +515,38 @@ DeviceState *qdev_device_add(QemuOpts *opts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* create device, set properties */
|
/* create device, set properties */
|
||||||
qdev = DEVICE(object_new(driver));
|
dev = DEVICE(object_new(driver));
|
||||||
|
|
||||||
if (bus) {
|
if (bus) {
|
||||||
qdev_set_parent_bus(qdev, bus);
|
qdev_set_parent_bus(dev, bus);
|
||||||
}
|
}
|
||||||
|
|
||||||
id = qemu_opts_id(opts);
|
id = qemu_opts_id(opts);
|
||||||
if (id) {
|
if (id) {
|
||||||
qdev->id = id;
|
dev->id = id;
|
||||||
}
|
}
|
||||||
if (qemu_opt_foreach(opts, set_property, qdev, 1) != 0) {
|
if (qemu_opt_foreach(opts, set_property, dev, 1) != 0) {
|
||||||
object_unparent(OBJECT(qdev));
|
object_unparent(OBJECT(dev));
|
||||||
object_unref(OBJECT(qdev));
|
object_unref(OBJECT(dev));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (qdev->id) {
|
if (dev->id) {
|
||||||
object_property_add_child(qdev_get_peripheral(), qdev->id,
|
object_property_add_child(qdev_get_peripheral(), dev->id,
|
||||||
OBJECT(qdev), NULL);
|
OBJECT(dev), NULL);
|
||||||
} else {
|
} else {
|
||||||
static int anon_count;
|
static int anon_count;
|
||||||
gchar *name = g_strdup_printf("device[%d]", anon_count++);
|
gchar *name = g_strdup_printf("device[%d]", anon_count++);
|
||||||
object_property_add_child(qdev_get_peripheral_anon(), name,
|
object_property_add_child(qdev_get_peripheral_anon(), name,
|
||||||
OBJECT(qdev), NULL);
|
OBJECT(dev), NULL);
|
||||||
g_free(name);
|
g_free(name);
|
||||||
}
|
}
|
||||||
if (qdev_init(qdev) < 0) {
|
if (qdev_init(dev) < 0) {
|
||||||
object_unref(OBJECT(qdev));
|
object_unref(OBJECT(dev));
|
||||||
qerror_report(QERR_DEVICE_INIT_FAILED, driver);
|
qerror_report(QERR_DEVICE_INIT_FAILED, driver);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
qdev->opts = opts;
|
dev->opts = opts;
|
||||||
return qdev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user