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>
This commit is contained in:
parent
66997c42e0
commit
851fd4a01d
28
block/vmdk.c
28
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)
|
||||
|
|
Loading…
Reference in New Issue