]> Git Repo - qemu.git/commitdiff
qom: Clean up error reporting in user_creatable_add_opts_foreach()
authorMarkus Armbruster <[email protected]>
Wed, 17 Oct 2018 08:26:43 +0000 (10:26 +0200)
committerMarkus Armbruster <[email protected]>
Fri, 19 Oct 2018 12:51:34 +0000 (14:51 +0200)
Calling error_report() in a function that takes an Error ** argument
is suspicious.  user_creatable_add_opts_foreach() does that, and then
fails without setting an error.  Its caller main(), via
qemu_opts_foreach(), is fine with it, but clean it up anyway.

Cc: Daniel P. BerrangĂ© <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Marc-AndrĂ© Lureau <[email protected]>
Message-Id: <20181017082702[email protected]>

qemu-io.c
qemu-nbd.c
qom/object_interfaces.c
vl.c

index 13829f5e21ba84e5cce5c39d2228377456eeb9db..6df7731af49603151f1925d97929f1f9202b8f05 100644 (file)
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -620,11 +620,9 @@ int main(int argc, char **argv)
         exit(1);
     }
 
-    if (qemu_opts_foreach(&qemu_object_opts,
-                          user_creatable_add_opts_foreach,
-                          NULL, NULL)) {
-        exit(1);
-    }
+    qemu_opts_foreach(&qemu_object_opts,
+                      user_creatable_add_opts_foreach,
+                      NULL, &error_fatal);
 
     if (!trace_init_backends()) {
         exit(1);
index 7874bc973ca3864ee1ad2f7a9580d7b354ec094b..ca7109652e56aea874706ae934bd071aa64026e9 100644 (file)
@@ -766,11 +766,9 @@ int main(int argc, char **argv)
         exit(EXIT_FAILURE);
     }
 
-    if (qemu_opts_foreach(&qemu_object_opts,
-                          user_creatable_add_opts_foreach,
-                          NULL, NULL)) {
-        exit(EXIT_FAILURE);
-    }
+    qemu_opts_foreach(&qemu_object_opts,
+                      user_creatable_add_opts_foreach,
+                      NULL, &error_fatal);
 
     if (!trace_init_backends()) {
         exit(1);
index 941fd63afd59e73569eea03a6293fe67cfd7117d..97b79b48bb29f609c8be6eac516d005c9c100d38 100644 (file)
@@ -143,7 +143,6 @@ int user_creatable_add_opts_foreach(void *opaque, QemuOpts *opts, Error **errp)
 {
     bool (*type_opt_predicate)(const char *, QemuOpts *) = opaque;
     Object *obj = NULL;
-    Error *err = NULL;
     const char *type;
 
     type = qemu_opt_get(opts, "qom-type");
@@ -152,9 +151,8 @@ int user_creatable_add_opts_foreach(void *opaque, QemuOpts *opts, Error **errp)
         return 0;
     }
 
-    obj = user_creatable_add_opts(opts, &err);
+    obj = user_creatable_add_opts(opts, errp);
     if (!obj) {
-        error_report_err(err);
         return -1;
     }
     object_unref(obj);
diff --git a/vl.c b/vl.c
index 87ad2e7de70f8bf6531333484da2553187fe8f27..f8a13d707096c04d153410b75776a8f18eb56274 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -4229,11 +4229,9 @@ int main(int argc, char **argv, char **envp)
     page_size_init();
     socket_init();
 
-    if (qemu_opts_foreach(qemu_find_opts("object"),
-                          user_creatable_add_opts_foreach,
-                          object_create_initial, NULL)) {
-        exit(1);
-    }
+    qemu_opts_foreach(qemu_find_opts("object"),
+                      user_creatable_add_opts_foreach,
+                      object_create_initial, &error_fatal);
 
     if (qemu_opts_foreach(qemu_find_opts("chardev"),
                           chardev_init_func, NULL, NULL)) {
@@ -4364,11 +4362,9 @@ int main(int argc, char **argv, char **envp)
         exit(1);
     }
 
-    if (qemu_opts_foreach(qemu_find_opts("object"),
-                          user_creatable_add_opts_foreach,
-                          object_create_delayed, NULL)) {
-        exit(1);
-    }
+    qemu_opts_foreach(qemu_find_opts("object"),
+                      user_creatable_add_opts_foreach,
+                      object_create_delayed, &error_fatal);
 
     if (tpm_init() < 0) {
         exit(1);
This page took 0.052985 seconds and 4 git commands to generate.