]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qapi: Clean up qobject_input_type_number() control flow
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Wed, 7 Jun 2017 16:35:57 +0000 (20:35 +0400)
committerMarkus Armbruster <armbru@redhat.com>
Mon, 19 Jun 2017 12:56:29 +0000 (14:56 +0200)
Use the more common pattern to error out.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170607163635.17635-6-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Commit message tweaked]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
qapi/qobject-input-visitor.c

index eac40f618a603d9c0a4da0986d4b9d9a7401d8fe..26ef49a60b5eadc40e556336c1910e20b5239d45 100644 (file)
@@ -547,13 +547,13 @@ static void qobject_input_type_number(Visitor *v, const char *name, double *obj,
     }
 
     qfloat = qobject_to_qfloat(qobj);
-    if (qfloat) {
-        *obj = qfloat_get_double(qobject_to_qfloat(qobj));
+    if (!qfloat) {
+        error_setg(errp, QERR_INVALID_PARAMETER_TYPE,
+                   full_name(qiv, name), "number");
         return;
     }
 
-    error_setg(errp, QERR_INVALID_PARAMETER_TYPE,
-               full_name(qiv, name), "number");
+    *obj = qfloat_get_double(qobject_to_qfloat(qobj));
 }
 
 static void qobject_input_type_number_keyval(Visitor *v, const char *name,