aboutsummaryrefslogtreecommitdiff
path: root/hw/core
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-07-07 18:06:04 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-07-10 15:18:08 +0200
commit992861fb1e4cf410f30ec8f05bd2dc2a14a5a027 (patch)
tree9d4d5de47d4ebae50838cd7f8ea39b89a3604507 /hw/core
parentaf175e85f92c870386ad74f466e29537b79611d3 (diff)
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>
Diffstat (limited to 'hw/core')
-rw-r--r--hw/core/numa.c44
1 files changed, 14 insertions, 30 deletions
diff --git a/hw/core/numa.c b/hw/core/numa.c
index de9a2f7e32..1b3267a607 100644
--- a/hw/core/numa.c
+++ b/hw/core/numa.c
@@ -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)