All the callees return either 0 or -1 so there is no need for propagating the value. And we bail on the first error. Remove the variable to make the function simpler. Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- src/qemu/qemu_extdevice.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c index 1869a42f11..9c0c0fd573 100644 --- a/src/qemu/qemu_extdevice.c +++ b/src/qemu/qemu_extdevice.c @@ -156,7 +156,6 @@ qemuExtDevicesStart(virQEMUDriverPtr driver, bool incomingMigration) { virDomainDefPtr def = vm->def; - int ret = 0; size_t i; if (qemuExtDevicesInitPaths(driver, def) < 0) @@ -166,14 +165,13 @@ qemuExtDevicesStart(virQEMUDriverPtr driver, virDomainVideoDefPtr video = def->videos[i]; if (video->backend == VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) { - ret = qemuExtVhostUserGPUStart(driver, vm, video); - if (ret < 0) - return ret; + if (qemuExtVhostUserGPUStart(driver, vm, video) < 0) + return -1; } } - if (def->tpm) - ret = qemuExtTPMStart(driver, vm, incomingMigration); + if (def->tpm && qemuExtTPMStart(driver, vm, incomingMigration) < 0) + return -1; for (i = 0; i < def->nnets; i++) { virDomainNetDefPtr net = def->nets[i]; @@ -184,7 +182,7 @@ qemuExtDevicesStart(virQEMUDriverPtr driver, return -1; } - return ret; + return 0; } -- 2.21.0