aboutsummaryrefslogtreecommitdiff
path: root/fsdev/qemu-fsdev.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2018-10-17 10:26:55 +0200
committerMarkus Armbruster <armbru@redhat.com>2018-10-19 14:51:34 +0200
commitb836723dfe642a67904bcd047feaaa0cda662d38 (patch)
treeee4fa92c0153cc6a85eaa2b6277189f99b0bed7e /fsdev/qemu-fsdev.c
parent9338570b7b0b8890269222b7b40e0b819f824dab (diff)
fsdev: Clean up error reporting in qemu_fsdev_add()
Calling error_report() from within a function that takes an Error ** argument is suspicious. qemu_fsdev_add() does that, and its caller fsdev_init_func() then fails without setting an error. Its caller main(), via qemu_opts_foreach(), is fine with it, but clean it up anyway. Cc: Greg Kurz <groug@kaod.org> Signed-off-by: Markus Armbruster <armbru@redhat.com> Acked-by: Greg Kurz <groug@kaod.org> Message-Id: <20181017082702.5581-32-armbru@redhat.com>
Diffstat (limited to 'fsdev/qemu-fsdev.c')
-rw-r--r--fsdev/qemu-fsdev.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/fsdev/qemu-fsdev.c b/fsdev/qemu-fsdev.c
index 8a4afbffbd..7a3b87cc9e 100644
--- a/fsdev/qemu-fsdev.c
+++ b/fsdev/qemu-fsdev.c
@@ -30,7 +30,7 @@ static FsDriverTable FsDrivers[] = {
{ .name = "proxy", .ops = &proxy_ops},
};
-int qemu_fsdev_add(QemuOpts *opts)
+int qemu_fsdev_add(QemuOpts *opts, Error **errp)
{
int i;
struct FsDriverListEntry *fsle;
@@ -38,10 +38,9 @@ int qemu_fsdev_add(QemuOpts *opts)
const char *fsdriver = qemu_opt_get(opts, "fsdriver");
const char *writeout = qemu_opt_get(opts, "writeout");
bool ro = qemu_opt_get_bool(opts, "readonly", 0);
- Error *local_err = NULL;
if (!fsdev_id) {
- error_report("fsdev: No id specified");
+ error_setg(errp, "fsdev: No id specified");
return -1;
}
@@ -53,11 +52,11 @@ int qemu_fsdev_add(QemuOpts *opts)
}
if (i == ARRAY_SIZE(FsDrivers)) {
- error_report("fsdev: fsdriver %s not found", fsdriver);
+ error_setg(errp, "fsdev: fsdriver %s not found", fsdriver);
return -1;
}
} else {
- error_report("fsdev: No fsdriver specified");
+ error_setg(errp, "fsdev: No fsdriver specified");
return -1;
}
@@ -76,8 +75,7 @@ int qemu_fsdev_add(QemuOpts *opts)
}
if (fsle->fse.ops->parse_opts) {
- if (fsle->fse.ops->parse_opts(opts, &fsle->fse, &local_err)) {
- error_report_err(local_err);
+ if (fsle->fse.ops->parse_opts(opts, &fsle->fse, errp)) {
g_free(fsle->fse.fsdev_id);
g_free(fsle);
return -1;