aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>2024-06-26 16:43:03 +0300
committerMichael Tokarev <mjt@tls.msk.ru>2024-06-30 19:51:44 +0300
commite9945a87816905c49172fae1905da3f25788750a (patch)
treeccf542c68feebcb048302cfca1f5b5aaea6bd9c1
parent875b2fabc063219303f6a8b5b1faba39dc0da906 (diff)
vl.c: select_machine(): use ERRP_GUARD instead of error propagation
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r--system/vl.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/system/vl.c b/system/vl.c
index 4dc862652f..fda93d150c 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -1665,28 +1665,28 @@ static const QEMUOption *lookup_opt(int argc, char **argv,
static MachineClass *select_machine(QDict *qdict, Error **errp)
{
+ ERRP_GUARD();
const char *machine_type = qdict_get_try_str(qdict, "type");
GSList *machines = object_class_get_list(TYPE_MACHINE, false);
- MachineClass *machine_class;
- Error *local_err = NULL;
+ MachineClass *machine_class = NULL;
if (machine_type) {
machine_class = find_machine(machine_type, machines);
qdict_del(qdict, "type");
if (!machine_class) {
- error_setg(&local_err, "unsupported machine type");
+ error_setg(errp, "unsupported machine type");
}
} else {
machine_class = find_default_machine(machines);
if (!machine_class) {
- error_setg(&local_err, "No machine specified, and there is no default");
+ error_setg(errp, "No machine specified, and there is no default");
}
}
g_slist_free(machines);
- if (local_err) {
- error_append_hint(&local_err, "Use -machine help to list supported machines\n");
- error_propagate(errp, local_err);
+ if (!machine_class) {
+ error_append_hint(errp,
+ "Use -machine help to list supported machines\n");
}
return machine_class;
}