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>
diff --git a/hw/core/numa.c b/hw/core/numa.c
index de9a2f7..1b3267a 100644
--- a/hw/core/numa.c
+++ b/hw/core/numa.c
@@ -456,40 +456,33 @@
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 @@
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 @@
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)