diff options
Diffstat (limited to 'hw/net/virtio-net.c')
-rw-r--r-- | hw/net/virtio-net.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 5150f29..439f823 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -855,19 +855,19 @@ static void failover_add_primary(VirtIONet *n, Error **errp) id = failover_find_primary_device_id(n); if (!id) { + error_setg(errp, "Primary device not found"); + error_append_hint(errp, "Virtio-net failover will not work. Make " + "sure primary device has parameter" + " failover_pair_id=%s\n", n->netclient_name); return; } opts = qemu_opts_find(qemu_find_opts("device"), id); - if (opts) { - dev = qdev_device_add(opts, &err); - if (err) { - qemu_opts_del(opts); - } + g_assert(opts); /* cannot be NULL because id was found using opts list */ + dev = qdev_device_add(opts, &err); + if (err) { + qemu_opts_del(opts); } else { - error_setg(errp, "Primary device not found"); - error_append_hint(errp, "Virtio-net failover will not work. Make " - "sure primary device has parameter" - " failover_pair_id=<virtio-net-id>\n"); + object_unref(OBJECT(dev)); } error_propagate(errp, err); } |