qdev: reorganize error reporting in bus_set_realized

No semantic change.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
Paolo Bonzini 2014-06-11 14:52:08 +02:00 committed by Michael S. Tsirkin
parent 0d156683f6
commit b7b34d055d

View file

@ -573,27 +573,19 @@ static void bus_set_realized(Object *obj, bool value, Error **errp)
if (value && !bus->realized) { if (value && !bus->realized) {
if (bc->realize) { if (bc->realize) {
bc->realize(bus, &local_err); bc->realize(bus, &local_err);
if (local_err != NULL) {
goto error;
}
} }
} else if (!value && bus->realized) { } else if (!value && bus->realized) {
if (bc->unrealize) { if (bc->unrealize) {
bc->unrealize(bus, &local_err); bc->unrealize(bus, &local_err);
if (local_err != NULL) {
goto error;
}
} }
} }
bus->realized = value; if (local_err != NULL) {
return; error_propagate(errp, local_err);
return;
}
error: bus->realized = value;
error_propagate(errp, local_err);
} }
void qbus_create_inplace(void *bus, size_t size, const char *typename, void qbus_create_inplace(void *bus, size_t size, const char *typename,