render / rpms / libvirt

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