|
@@ -1665,28 +1665,27 @@ 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;
|
|
|
+ g_autoptr(GSList) machines = object_class_get_list(TYPE_MACHINE, false);
|
|
|
+ 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: \"%s\"", optarg);
|
|
|
}
|
|
|
} 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;
|
|
|
}
|
|
@@ -3546,8 +3545,8 @@ void qemu_init(int argc, char **argv)
|
|
|
if (!opts) {
|
|
|
exit(1);
|
|
|
}
|
|
|
- enable_mlock = qemu_opt_get_bool(opts, "mem-lock", false);
|
|
|
- enable_cpu_pm = qemu_opt_get_bool(opts, "cpu-pm", false);
|
|
|
+ enable_mlock = qemu_opt_get_bool(opts, "mem-lock", enable_mlock);
|
|
|
+ enable_cpu_pm = qemu_opt_get_bool(opts, "cpu-pm", enable_cpu_pm);
|
|
|
break;
|
|
|
case QEMU_OPTION_compat:
|
|
|
{
|