[libvirt] [PATCH] qemu_hotplug: Drop dead code in net update

Jiri Denemark jdenemar at redhat.com
Thu Feb 22 14:00:25 UTC 2018


vm->def->nets[changeidx] can never be NULL for changeidx returned by
virDomainNetFindIdx.

Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 src/qemu/qemu_hotplug.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 87cf578acc..e0a5300f08 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -3061,12 +3061,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
     if ((changeidx = virDomainNetFindIdx(vm->def, newdev)) < 0)
         goto cleanup;
     devslot = &vm->def->nets[changeidx];
-
-    if (!(olddev = *devslot)) {
-        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                       _("cannot find existing network device to modify"));
-        goto cleanup;
-    }
+    olddev = *devslot;
 
     oldType = virDomainNetGetActualType(olddev);
     if (oldType == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
-- 
2.16.2




More information about the libvir-list mailing list