qapi: Use returned bool to check for failure, manual part

The previous commit used Coccinelle to convert from checking the Error
object to checking the return value.  Convert a few more manually.
Also tweak control flow in places to conform to the conventional "if
error bail out" pattern.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20200707160613.848843-20-armbru@redhat.com>
This commit is contained in:
Markus Armbruster 2020-07-07 18:05:47 +02:00
parent 62a35aaa31
commit 14217038bc
9 changed files with 44 additions and 56 deletions

View file

@ -761,15 +761,15 @@ static void set_pci_devfn(Object *obj, Visitor *v, const char *name,
if (!visit_type_str(v, name, &str, &local_err)) {
error_free(local_err);
local_err = NULL;
visit_type_int32(v, name, &value, &local_err);
if (local_err) {
error_propagate(errp, local_err);
} else if (value < -1 || value > 255) {
if (!visit_type_int32(v, name, &value, errp)) {
return;
}
if (value < -1 || value > 255) {
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
name ? name : "null", "pci_devfn");
} else {
*ptr = value;
return;
}
*ptr = value;
return;
}