qemu_hotplug: Properly check for qemuMonitorDelDevice retval

Luckily, the function returns only 0 or -1 so all the checks work
as expected. Anyway, our rule is that a positive value means
success so if the function ever returns a positive value these
checks will fail. Make them check for a negative value properly.

At the same time fix qemuDomainDetachExtensionDevice() reval
check. It is somewhat related to the aim of this patch.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik 2019-03-12 09:28:18 +01:00
parent 1dd24167b8
commit 8b71b0c727

View File

@ -5457,11 +5457,11 @@ int qemuDomainDetachControllerDevice(virQEMUDriverPtr driver,
qemuDomainObjEnterMonitor(driver, vm);
if (detach->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
qemuDomainDetachExtensionDevice(priv->mon, &detach->info)) {
qemuDomainDetachExtensionDevice(priv->mon, &detach->info) < 0) {
goto exit_monitor;
}
if (qemuMonitorDelDevice(priv->mon, detach->info.alias)) {
if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
ignore_value(qemuDomainObjExitMonitor(driver, vm));
goto cleanup;
}
@ -6975,7 +6975,7 @@ qemuDomainDetachInputDevice(virDomainObjPtr vm,
qemuDomainMarkDeviceForRemoval(vm, &input->info);
qemuDomainObjEnterMonitor(driver, vm);
if (qemuMonitorDelDevice(priv->mon, input->info.alias)) {
if (qemuMonitorDelDevice(priv->mon, input->info.alias) < 0) {
ignore_value(qemuDomainObjExitMonitor(driver, vm));
goto cleanup;
}
@ -7018,7 +7018,7 @@ qemuDomainDetachVsockDevice(virDomainObjPtr vm,
qemuDomainMarkDeviceForRemoval(vm, &vsock->info);
qemuDomainObjEnterMonitor(driver, vm);
if (qemuMonitorDelDevice(priv->mon, vsock->info.alias)) {
if (qemuMonitorDelDevice(priv->mon, vsock->info.alias) < 0) {
ignore_value(qemuDomainObjExitMonitor(driver, vm));
goto cleanup;
}