This is basically an old artefact from 24b0821926e when the idea was: 1) Build device string only to see if chardev has any -device associated with it and thus if device_del is needed 2) Detach chardev using chardev_del Now, that DEVICE and DEVICE_DELETED capabilities are assumed for every domain 1) does not make sense anymore. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- 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 107d0fb7a9..60b393234a 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -6129,7 +6129,6 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr driver, qemuDomainObjPrivatePtr priv = vm->privateData; virDomainDefPtr vmdef = vm->def; virDomainChrDefPtr tmpChr; - char *devstr = NULL; bool guestfwd = false; if (!(tmpChr = virDomainChrFind(vmdef, chr))) { @@ -6150,9 +6149,6 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr driver, sa_assert(tmpChr->info.alias); - if (qemuBuildChrDeviceStr(&devstr, vmdef, tmpChr, priv->qemuCaps) < 0) - goto cleanup; - if (!async && !guestfwd) qemuDomainMarkDeviceForRemoval(vm, &tmpChr->info); @@ -6163,7 +6159,7 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr driver, goto cleanup; } } else { - if (devstr && qemuMonitorDelDevice(priv->mon, tmpChr->info.alias) < 0) { + if (qemuMonitorDelDevice(priv->mon, tmpChr->info.alias) < 0) { ignore_value(qemuDomainObjExitMonitor(driver, vm)); goto cleanup; } @@ -6183,7 +6179,6 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr driver, cleanup: if (!async) qemuDomainResetDeviceRemoval(vm); - VIR_FREE(devstr); return ret; } -- 2.19.2