render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
d76c62
From 9c51a4657bf446bf2ccaba65b2f76d29e5b14f22 Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <9c51a4657bf446bf2ccaba65b2f76d29e5b14f22@dist-git>
d76c62
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
d76c62
Date: Wed, 4 Mar 2020 12:42:31 +0100
d76c62
Subject: [PATCH] qemu: eliminate ret in qemuExtDevicesStart
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
All the callees return either 0 or -1 so there is no need
d76c62
for propagating the value. And we bail on the first error.
d76c62
d76c62
Remove the variable to make the function simpler.
d76c62
d76c62
Signed-off-by: Ján Tomko <jtomko@redhat.com>
d76c62
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
d76c62
(cherry picked from commit d5256cbd5575fb714714de1d543d1e5d41daf8ff)
d76c62
Signed-off-by: Ján Tomko <jtomko@redhat.com>
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1694166
d76c62
Message-Id: <1a2cb184deb18bf67e3fdc50785e829f74d89352.1583322090.git.jtomko@redhat.com>
d76c62
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
d76c62
---
d76c62
 src/qemu/qemu_extdevice.c | 12 +++++-------
d76c62
 1 file changed, 5 insertions(+), 7 deletions(-)
d76c62
d76c62
diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c
d76c62
index 1869a42f11..9c0c0fd573 100644
d76c62
--- a/src/qemu/qemu_extdevice.c
d76c62
+++ b/src/qemu/qemu_extdevice.c
d76c62
@@ -156,7 +156,6 @@ qemuExtDevicesStart(virQEMUDriverPtr driver,
d76c62
                     bool incomingMigration)
d76c62
 {
d76c62
     virDomainDefPtr def = vm->def;
d76c62
-    int ret = 0;
d76c62
     size_t i;
d76c62
 
d76c62
     if (qemuExtDevicesInitPaths(driver, def) < 0)
d76c62
@@ -166,14 +165,13 @@ qemuExtDevicesStart(virQEMUDriverPtr driver,
d76c62
         virDomainVideoDefPtr video = def->videos[i];
d76c62
 
d76c62
         if (video->backend == VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) {
d76c62
-            ret = qemuExtVhostUserGPUStart(driver, vm, video);
d76c62
-            if (ret < 0)
d76c62
-                return ret;
d76c62
+            if (qemuExtVhostUserGPUStart(driver, vm, video) < 0)
d76c62
+                return -1;
d76c62
         }
d76c62
     }
d76c62
 
d76c62
-    if (def->tpm)
d76c62
-        ret = qemuExtTPMStart(driver, vm, incomingMigration);
d76c62
+    if (def->tpm && qemuExtTPMStart(driver, vm, incomingMigration) < 0)
d76c62
+        return -1;
d76c62
 
d76c62
     for (i = 0; i < def->nnets; i++) {
d76c62
         virDomainNetDefPtr net = def->nets[i];
d76c62
@@ -184,7 +182,7 @@ qemuExtDevicesStart(virQEMUDriverPtr driver,
d76c62
             return -1;
d76c62
     }
d76c62
 
d76c62
-    return ret;
d76c62
+    return 0;
d76c62
 }
d76c62
 
d76c62
 
d76c62
-- 
d76c62
2.25.1
d76c62