qapi: Clean up qobject_input_type_number() control flow

Use the more common pattern to error out.

Backports commit 58634047b7deeab36e4b07c4744e44d698975561 from qemu
This commit is contained in:
Marc-André Lureau 2018-03-03 17:40:35 -05:00 committed by Lioncash
parent d70f3bfc6b
commit f1dbfe6be6
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -441,13 +441,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_any(Visitor *v, const char *name, QObject **obj,