From: Marc-André Lureau Date: Wed, 7 Jun 2017 16:35:57 +0000 (+0400) Subject: qapi: Clean up qobject_input_type_number() control flow X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=58634047b7deeab36e4b07c4744e44d698975561;p=qemu.git qapi: Clean up qobject_input_type_number() control flow Use the more common pattern to error out. Signed-off-by: Marc-André Lureau Message-Id: <20170607163635.17635-6-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster [Commit message tweaked] Signed-off-by: Markus Armbruster --- diff --git a/qapi/qobject-input-visitor.c b/qapi/qobject-input-visitor.c index eac40f618a..26ef49a60b 100644 --- a/qapi/qobject-input-visitor.c +++ b/qapi/qobject-input-visitor.c @@ -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,