mirror of
https://github.com/mii443/qemu.git
synced 2025-12-03 11:08:25 +00:00
vhost: simplify vhost_dev_init() fail_busyloop label
Requiring a conditional for every goto is tedious:
if (busyloop_timeout) {
goto fail_busyloop;
} else {
goto fail;
}
Move the conditional to into the fail_busyloop label so that it's safe
to jump to this label unconditionally.
This change makes the migrate_add_blocker() error case more consistent.
It jumped to fail_busyloop unconditionally whereas the memslots limits
error case was conditional.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20210222114931.272308-1-stefanha@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
committed by
Michael S. Tsirkin
parent
b52fa0ea45
commit
1d8d014e93
@@ -1388,18 +1388,16 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
|
|||||||
error_report("vhost backend memory slots limit is less"
|
error_report("vhost backend memory slots limit is less"
|
||||||
" than current number of present memory slots");
|
" than current number of present memory slots");
|
||||||
r = -1;
|
r = -1;
|
||||||
if (busyloop_timeout) {
|
goto fail_busyloop;
|
||||||
goto fail_busyloop;
|
|
||||||
} else {
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail_busyloop:
|
fail_busyloop:
|
||||||
while (--i >= 0) {
|
if (busyloop_timeout) {
|
||||||
vhost_virtqueue_set_busyloop_timeout(hdev, hdev->vq_index + i, 0);
|
while (--i >= 0) {
|
||||||
|
vhost_virtqueue_set_busyloop_timeout(hdev, hdev->vq_index + i, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fail:
|
fail:
|
||||||
hdev->nvqs = n_initialized_vqs;
|
hdev->nvqs = n_initialized_vqs;
|
||||||
|
|||||||
Reference in New Issue
Block a user