mirror of https://gitee.com/openkylin/qemu.git
hw/core/qdev: cleanup Error ** variables
Rename Error ** parameter in check_only_migratable to common errp. In device_set_realized: - Move "if (local_err != NULL)" closer to error setters. - Drop 'Error **local_errp': it doesn't save any LoCs, but it's very unusual. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191205174635.18758-10-vsementsov@virtuozzo.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
4c5ec47e63
commit
40f03bd55c
|
@ -820,12 +820,12 @@ static bool device_get_realized(Object *obj, Error **errp)
|
|||
return dev->realized;
|
||||
}
|
||||
|
||||
static bool check_only_migratable(Object *obj, Error **err)
|
||||
static bool check_only_migratable(Object *obj, Error **errp)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_GET_CLASS(obj);
|
||||
|
||||
if (!vmstate_check_only_migratable(dc->vmsd)) {
|
||||
error_setg(err, "Device %s is not migratable, but "
|
||||
error_setg(errp, "Device %s is not migratable, but "
|
||||
"--only-migratable was specified",
|
||||
object_get_typename(obj));
|
||||
return false;
|
||||
|
@ -874,10 +874,9 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
|
|||
|
||||
if (dc->realize) {
|
||||
dc->realize(dev, &local_err);
|
||||
}
|
||||
|
||||
if (local_err != NULL) {
|
||||
goto fail;
|
||||
if (local_err != NULL) {
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
DEVICE_LISTENER_CALL(realize, Forward, dev);
|
||||
|
@ -918,27 +917,26 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
|
|||
}
|
||||
|
||||
} else if (!value && dev->realized) {
|
||||
Error **local_errp = NULL;
|
||||
/* We want local_err to track only the first error */
|
||||
QLIST_FOREACH(bus, &dev->child_bus, sibling) {
|
||||
local_errp = local_err ? NULL : &local_err;
|
||||
object_property_set_bool(OBJECT(bus), false, "realized",
|
||||
local_errp);
|
||||
local_err ? NULL : &local_err);
|
||||
}
|
||||
if (qdev_get_vmsd(dev)) {
|
||||
vmstate_unregister(dev, qdev_get_vmsd(dev), dev);
|
||||
}
|
||||
if (dc->unrealize) {
|
||||
local_errp = local_err ? NULL : &local_err;
|
||||
dc->unrealize(dev, local_errp);
|
||||
dc->unrealize(dev, local_err ? NULL : &local_err);
|
||||
}
|
||||
dev->pending_deleted_event = true;
|
||||
DEVICE_LISTENER_CALL(unrealize, Reverse, dev);
|
||||
|
||||
if (local_err != NULL) {
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
if (local_err != NULL) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
assert(local_err == NULL);
|
||||
dev->realized = value;
|
||||
return;
|
||||
|
||||
|
@ -976,7 +974,7 @@ static bool device_get_hotpluggable(Object *obj, Error **errp)
|
|||
qbus_is_hotpluggable(dev->parent_bus));
|
||||
}
|
||||
|
||||
static bool device_get_hotplugged(Object *obj, Error **err)
|
||||
static bool device_get_hotplugged(Object *obj, Error **errp)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
|
||||
|
|
Loading…
Reference in New Issue