diff options
author | Juan Quintela | 2020-11-18 09:37:40 +0100 |
---|---|---|
committer | Michael S. Tsirkin | 2020-12-08 19:48:58 +0100 |
commit | 5f2ef3b0d032797b6bad9449dfece3a8111a8529 (patch) | |
tree | 607f5144adba70a37b74f2d7ab46b3030c9fb7fb | |
parent | failover: Rename to failover_find_primary_device() (diff) | |
download | qemu-5f2ef3b0d032797b6bad9449dfece3a8111a8529.tar.gz qemu-5f2ef3b0d032797b6bad9449dfece3a8111a8529.tar.xz qemu-5f2ef3b0d032797b6bad9449dfece3a8111a8529.zip |
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>
-rw-r--r-- | softmmu/qdev-monitor.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c index a25f5d612c..12b7540f17 100644 --- a/softmmu/qdev-monitor.c +++ b/softmmu/qdev-monitor.c @@ -600,7 +600,6 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp) const char *driver, *path; DeviceState *dev = NULL; BusState *bus = NULL; - bool hide; driver = qemu_opt_get(opts, "driver"); if (!driver) { @@ -634,14 +633,16 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp) return NULL; } } - hide = should_hide_device(opts); - if ((hide || qdev_hotplug) && bus && !qbus_is_hotpluggable(bus)) { - error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name); + if (should_hide_device(opts)) { + if (bus && !qbus_is_hotpluggable(bus)) { + error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name); + } return NULL; } - if (hide) { + if (qdev_hotplug && bus && !qbus_is_hotpluggable(bus)) { + error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name); return NULL; } |