aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2022-11-22 14:49:17 +0100
committerMarkus Armbruster <armbru@redhat.com>2022-12-14 16:19:35 +0100
commit851fd4a01dcf579f96f18d41b3e4bf369b64ef3a (patch)
tree56087a81cd92b7864df18bbbc94fc37ee4541fa3
parent66997c42e02c84481fc162a5b7bd6ad6c643bae2 (diff)
downloadqemu-851fd4a01dcf579f96f18d41b3e4bf369b64ef3a.zip
qemu-851fd4a01dcf579f96f18d41b3e4bf369b64ef3a.tar.gz
qemu-851fd4a01dcf579f96f18d41b3e4bf369b64ef3a.tar.bz2
block/vmdk: Simplify vmdk_co_create() to return directly
Cc: Fam Zheng <fam@euphon.net> Cc: Kevin Wolf <kwolf@redhat.com> Cc: Hanna Reitz <hreitz@redhat.com> Cc: qemu-block@nongnu.org Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20221122134917.1217307-3-armbru@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-rw-r--r--block/vmdk.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/block/vmdk.c b/block/vmdk.c
index 2637635..bac3d8d 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -2821,7 +2821,6 @@ static BlockBackend *vmdk_co_create_cb(int64_t size, int idx,
static int coroutine_fn vmdk_co_create(BlockdevCreateOptions *create_options,
Error **errp)
{
- int ret;
BlockdevCreateOptionsVmdk *opts;
opts = &create_options->u.vmdk;
@@ -2829,24 +2828,19 @@ static int coroutine_fn vmdk_co_create(BlockdevCreateOptions *create_options,
/* Validate options */
if (!QEMU_IS_ALIGNED(opts->size, BDRV_SECTOR_SIZE)) {
error_setg(errp, "Image size must be a multiple of 512 bytes");
- ret = -EINVAL;
- goto out;
+ return -EINVAL;
}
- ret = vmdk_co_do_create(opts->size,
- opts->subformat,
- opts->adapter_type,
- opts->backing_file,
- opts->hwversion,
- opts->toolsversion,
- false,
- opts->zeroed_grain,
- vmdk_co_create_cb,
- opts, errp);
- return ret;
-
-out:
- return ret;
+ return vmdk_co_do_create(opts->size,
+ opts->subformat,
+ opts->adapter_type,
+ opts->backing_file,
+ opts->hwversion,
+ opts->toolsversion,
+ false,
+ opts->zeroed_grain,
+ vmdk_co_create_cb,
+ opts, errp);
}
static void vmdk_close(BlockDriverState *bs)