render / rpms / libvirt

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