error: Convert do_device_add() to QError
Conversion to QObject is still missing.
This commit is contained in:
parent
3801cf8ae5
commit
0204276bc9
19
hw/qdev.c
19
hw/qdev.c
@ -200,15 +200,15 @@ DeviceState *qdev_device_add(QemuOpts *opts)
|
|||||||
|
|
||||||
driver = qemu_opt_get(opts, "driver");
|
driver = qemu_opt_get(opts, "driver");
|
||||||
if (!driver) {
|
if (!driver) {
|
||||||
error_report("-device: no driver specified");
|
qerror_report(QERR_MISSING_PARAMETER, "driver");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find driver */
|
/* find driver */
|
||||||
info = qdev_find_info(NULL, driver);
|
info = qdev_find_info(NULL, driver);
|
||||||
if (!info || info->no_user) {
|
if (!info || info->no_user) {
|
||||||
error_report("Device \"%s\" not found. Try -device '?' for a list.",
|
qerror_report(QERR_INVALID_PARAMETER, "driver");
|
||||||
driver);
|
error_printf_unless_qmp("Try with argument '?' for a list.\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,21 +220,20 @@ DeviceState *qdev_device_add(QemuOpts *opts)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (bus->info != info->bus_info) {
|
if (bus->info != info->bus_info) {
|
||||||
error_report("Device '%s' can't go on a %s bus",
|
qerror_report(QERR_BAD_BUS_FOR_DEVICE,
|
||||||
driver, bus->info->name);
|
driver, bus->info->name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bus = qbus_find_recursive(main_system_bus, NULL, info->bus_info);
|
bus = qbus_find_recursive(main_system_bus, NULL, info->bus_info);
|
||||||
if (!bus) {
|
if (!bus) {
|
||||||
error_report("Did not find %s bus for %s",
|
qerror_report(QERR_NO_BUS_FOR_DEVICE,
|
||||||
info->bus_info->name, info->name);
|
info->name, info->bus_info->name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (qdev_hotplug && !bus->allow_hotplug) {
|
if (qdev_hotplug && !bus->allow_hotplug) {
|
||||||
error_report("Bus %s does not support hotplugging",
|
qerror_report(QERR_BUS_NO_HOTPLUG, bus->name);
|
||||||
bus->name);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +248,7 @@ DeviceState *qdev_device_add(QemuOpts *opts)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (qdev_init(qdev) < 0) {
|
if (qdev_init(qdev) < 0) {
|
||||||
error_report("Error initializing device %s", driver);
|
qerror_report(QERR_DEVICE_INIT_FAILED, driver);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
qdev->opts = opts;
|
qdev->opts = opts;
|
||||||
|
Loading…
Reference in New Issue
Block a user