mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
error: Eliminate error_propagate() manually
When all we do with an Error we receive into a local variable is propagating to somewhere else, we can just as well receive it there right away. The previous two commits did that for sufficiently simple cases with Coccinelle. Do it for several more manually. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20200707160613.848843-37-armbru@redhat.com>
This commit is contained in:
parent
af175e85f9
commit
992861fb1e
18 changed files with 67 additions and 149 deletions
|
@ -456,40 +456,33 @@ void parse_numa_hmat_cache(MachineState *ms, NumaHmatCacheOptions *node,
|
|||
|
||||
void set_numa_options(MachineState *ms, NumaOptions *object, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
|
||||
if (!ms->numa_state) {
|
||||
error_setg(errp, "NUMA is not supported by this machine-type");
|
||||
goto end;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (object->type) {
|
||||
case NUMA_OPTIONS_TYPE_NODE:
|
||||
parse_numa_node(ms, &object->u.node, &err);
|
||||
if (err) {
|
||||
goto end;
|
||||
}
|
||||
parse_numa_node(ms, &object->u.node, errp);
|
||||
break;
|
||||
case NUMA_OPTIONS_TYPE_DIST:
|
||||
parse_numa_distance(ms, &object->u.dist, &err);
|
||||
if (err) {
|
||||
goto end;
|
||||
}
|
||||
parse_numa_distance(ms, &object->u.dist, errp);
|
||||
break;
|
||||
case NUMA_OPTIONS_TYPE_CPU:
|
||||
if (!object->u.cpu.has_node_id) {
|
||||
error_setg(&err, "Missing mandatory node-id property");
|
||||
goto end;
|
||||
error_setg(errp, "Missing mandatory node-id property");
|
||||
return;
|
||||
}
|
||||
if (!ms->numa_state->nodes[object->u.cpu.node_id].present) {
|
||||
error_setg(&err, "Invalid node-id=%" PRId64 ", NUMA node must be "
|
||||
"defined with -numa node,nodeid=ID before it's used with "
|
||||
"-numa cpu,node-id=ID", object->u.cpu.node_id);
|
||||
goto end;
|
||||
error_setg(errp, "Invalid node-id=%" PRId64 ", NUMA node must be "
|
||||
"defined with -numa node,nodeid=ID before it's used with "
|
||||
"-numa cpu,node-id=ID", object->u.cpu.node_id);
|
||||
return;
|
||||
}
|
||||
|
||||
machine_set_cpu_numa_node(ms, qapi_NumaCpuOptions_base(&object->u.cpu),
|
||||
&err);
|
||||
machine_set_cpu_numa_node(ms,
|
||||
qapi_NumaCpuOptions_base(&object->u.cpu),
|
||||
errp);
|
||||
break;
|
||||
case NUMA_OPTIONS_TYPE_HMAT_LB:
|
||||
if (!ms->numa_state->hmat_enabled) {
|
||||
|
@ -499,10 +492,7 @@ void set_numa_options(MachineState *ms, NumaOptions *object, Error **errp)
|
|||
return;
|
||||
}
|
||||
|
||||
parse_numa_hmat_lb(ms->numa_state, &object->u.hmat_lb, &err);
|
||||
if (err) {
|
||||
goto end;
|
||||
}
|
||||
parse_numa_hmat_lb(ms->numa_state, &object->u.hmat_lb, errp);
|
||||
break;
|
||||
case NUMA_OPTIONS_TYPE_HMAT_CACHE:
|
||||
if (!ms->numa_state->hmat_enabled) {
|
||||
|
@ -512,17 +502,11 @@ void set_numa_options(MachineState *ms, NumaOptions *object, Error **errp)
|
|||
return;
|
||||
}
|
||||
|
||||
parse_numa_hmat_cache(ms, &object->u.hmat_cache, &err);
|
||||
if (err) {
|
||||
goto end;
|
||||
}
|
||||
parse_numa_hmat_cache(ms, &object->u.hmat_cache, errp);
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
|
||||
end:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
static int parse_numa(void *opaque, QemuOpts *opts, Error **errp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue