blkdebug: Employ error parameter

Make use of the error parameter in blkdebug_open.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Max Reitz 2013-10-10 15:44:03 +02:00 committed by Kevin Wolf
parent c6252b7cea
commit 10ffa72fae
1 changed files with 4 additions and 4 deletions

View File

@ -362,8 +362,7 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags,
opts = qemu_opts_create_nofail(&runtime_opts); opts = qemu_opts_create_nofail(&runtime_opts);
qemu_opts_absorb_qdict(opts, options, &local_err); qemu_opts_absorb_qdict(opts, options, &local_err);
if (error_is_set(&local_err)) { if (error_is_set(&local_err)) {
qerror_report_err(local_err); error_propagate(errp, local_err);
error_free(local_err);
ret = -EINVAL; ret = -EINVAL;
goto fail; goto fail;
} }
@ -373,6 +372,7 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags,
if (config) { if (config) {
ret = read_config(s, config); ret = read_config(s, config);
if (ret < 0) { if (ret < 0) {
error_setg_errno(errp, -ret, "Could not read blkdebug config file");
goto fail; goto fail;
} }
} }
@ -383,14 +383,14 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags,
/* Open the backing file */ /* Open the backing file */
filename = qemu_opt_get(opts, "x-image"); filename = qemu_opt_get(opts, "x-image");
if (filename == NULL) { if (filename == NULL) {
error_setg(errp, "Could not retrieve image file name");
ret = -EINVAL; ret = -EINVAL;
goto fail; goto fail;
} }
ret = bdrv_file_open(&bs->file, filename, NULL, flags, &local_err); ret = bdrv_file_open(&bs->file, filename, NULL, flags, &local_err);
if (ret < 0) { if (ret < 0) {
qerror_report_err(local_err); error_propagate(errp, local_err);
error_free(local_err);
goto fail; goto fail;
} }