From 5bf670323e5db11f3b45b8a77a43e905e3256114 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Tue, 3 Jun 2014 10:18:48 +0200 Subject: [PATCH] qemu: Return in from qemuDomainRemove*Device Some of the APIs already return int since they can produce errors that need to be propagated. For consistency reasons, this patch changes the rest of the APIs to also return int even though they do not fail or report any errors. --- src/qemu/qemu_hotplug.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 9ea9ff64c1..cd43dd5ecb 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2523,7 +2523,7 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver, } -static void +static int qemuDomainRemoveControllerDevice(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainControllerDefPtr controller) @@ -2547,6 +2547,7 @@ qemuDomainRemoveControllerDevice(virQEMUDriverPtr driver, qemuDomainReleaseDeviceAddress(vm, &controller->info, NULL); virDomainControllerDefFree(controller); + return 0; } @@ -2575,7 +2576,7 @@ qemuDomainRemoveSCSIHostDevice(virQEMUDriverPtr driver, qemuDomainReAttachHostSCSIDevices(driver, vm->def->name, &hostdev, 1); } -static void +static int qemuDomainRemoveHostDevice(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainHostdevDefPtr hostdev) @@ -2641,6 +2642,7 @@ qemuDomainRemoveHostDevice(virQEMUDriverPtr driver, virDomainNetDefFree(net); } virObjectUnref(cfg); + return 0; } @@ -2659,8 +2661,8 @@ qemuDomainRemoveNetDevice(virQEMUDriverPtr driver, if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_HOSTDEV) { /* this function handles all hostdev and netdev cleanup */ - qemuDomainRemoveHostDevice(driver, vm, virDomainNetGetActualHostdev(net)); - ret = 0; + ret = qemuDomainRemoveHostDevice(driver, vm, + virDomainNetGetActualHostdev(net)); goto cleanup; } @@ -3189,9 +3191,9 @@ int qemuDomainDetachControllerDevice(virQEMUDriverPtr driver, rc = qemuDomainWaitForDeviceRemoval(vm); if (rc == 0 || rc == 1) - qemuDomainRemoveControllerDevice(driver, vm, detach); - - ret = 0; + ret = qemuDomainRemoveControllerDevice(driver, vm, detach); + else + ret = 0; cleanup: qemuDomainResetDeviceRemoval(vm); @@ -3345,7 +3347,7 @@ qemuDomainDetachThisHostDevice(virQEMUDriverPtr driver, } else { int rc = qemuDomainWaitForDeviceRemoval(vm); if (rc == 0 || rc == 1) - qemuDomainRemoveHostDevice(driver, vm, detach); + ret = qemuDomainRemoveHostDevice(driver, vm, detach); } qemuDomainResetDeviceRemoval(vm); -- GitLab