From 9c51a4657bf446bf2ccaba65b2f76d29e5b14f22 Mon Sep 17 00:00:00 2001 Message-Id: <9c51a4657bf446bf2ccaba65b2f76d29e5b14f22@dist-git> From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Wed, 4 Mar 2020 12:42:31 +0100 Subject: [PATCH] qemu: eliminate ret in qemuExtDevicesStart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Peter Krempa (cherry picked from commit d5256cbd5575fb714714de1d543d1e5d41daf8ff) Signed-off-by: Ján Tomko https://bugzilla.redhat.com/show_bug.cgi?id=1694166 Message-Id: <1a2cb184deb18bf67e3fdc50785e829f74d89352.1583322090.git.jtomko@redhat.com> Reviewed-by: Michal Privoznik --- 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.25.1