mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-01 14:31:52 -06:00
failover: simplify qdev_device_add() failover case
Just put allthe logic inside the same if. Signed-off-by: Juan Quintela <quintela@redhat.com> Message-Id: <20201118083748.1328-20-quintela@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
85d3b93196
commit
5f2ef3b0d0
1 changed files with 6 additions and 5 deletions
|
@ -600,7 +600,6 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
|
||||||
const char *driver, *path;
|
const char *driver, *path;
|
||||||
DeviceState *dev = NULL;
|
DeviceState *dev = NULL;
|
||||||
BusState *bus = NULL;
|
BusState *bus = NULL;
|
||||||
bool hide;
|
|
||||||
|
|
||||||
driver = qemu_opt_get(opts, "driver");
|
driver = qemu_opt_get(opts, "driver");
|
||||||
if (!driver) {
|
if (!driver) {
|
||||||
|
@ -634,14 +633,16 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hide = should_hide_device(opts);
|
|
||||||
|
|
||||||
if ((hide || qdev_hotplug) && bus && !qbus_is_hotpluggable(bus)) {
|
if (should_hide_device(opts)) {
|
||||||
error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name);
|
if (bus && !qbus_is_hotpluggable(bus)) {
|
||||||
|
error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name);
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hide) {
|
if (qdev_hotplug && bus && !qbus_is_hotpluggable(bus)) {
|
||||||
|
error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue