[libvirt PATCH 2/8] Remove redundant conditions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



All of these have been checked earlier.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/hypervisor/virhostdev.c | 2 +-
 src/libxl/xen_xl.c          | 2 +-
 src/qemu/qemu_hotplug.c     | 3 +--
 src/qemu/qemu_process.c     | 6 +++---
 src/rpc/virnetsocket.c      | 2 +-
 src/util/virlease.c         | 2 +-
 src/vbox/vbox_common.c      | 2 +-
 7 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c
index 9017cc3be8..69102b8ebf 100644
--- a/src/hypervisor/virhostdev.c
+++ b/src/hypervisor/virhostdev.c
@@ -1425,7 +1425,7 @@ virHostdevFindUSBDevice(virDomainHostdevDefPtr hostdev,
                      usbsrc->bus, usbsrc->device,
                      bus, device);
         }
-    } else if (!vendor && bus) {
+    } else if (bus) {
         if (virUSBDeviceFindByBus(bus, device, NULL, mandatory, usb) < 0)
             return -1;
     }
diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
index f9dc18ab18..e83a019bcc 100644
--- a/src/libxl/xen_xl.c
+++ b/src/libxl/xen_xl.c
@@ -450,7 +450,7 @@ xenParseXLVnuma(virConfPtr conf,
         unsigned long long kbsize = 0;
 
         /* Is there a sublist (vnode)? */
-        if (list && list->type == VIR_CONF_LIST) {
+        if (list->type == VIR_CONF_LIST) {
             vnode = list->list;
 
             while (vnode && vnode->type == VIR_CONF_STRING) {
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 26912334d2..b902c1aba1 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -4711,8 +4711,7 @@ qemuDomainRemoveRNGDevice(virQEMUDriverPtr driver,
 
     qemuDomainObjEnterMonitor(driver, vm);
 
-    if (rc == 0 &&
-        qemuMonitorDelObject(priv->mon, objAlias, true) < 0)
+    if (qemuMonitorDelObject(priv->mon, objAlias, true) < 0)
         rc = -1;
 
     if (rng->backend == VIR_DOMAIN_RNG_BACKEND_EGD &&
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ec6ca14bbd..e99d9f76fe 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -6888,11 +6888,11 @@ qemuProcessLaunch(virConnectPtr conn,
         goto cleanup;
     VIR_DEBUG("Handshake complete, child running");
 
-    if (rv == -1) /* The VM failed to start; tear filters before taps */
+    if (rv == -1) {
+        /* The VM failed to start; tear filters before taps */
         virDomainConfVMNWFilterTeardown(vm);
-
-    if (rv == -1) /* The VM failed to start */
         goto cleanup;
+    }
 
     if (qemuDomainObjStartWorker(vm) < 0)
         goto cleanup;
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 5a7f501923..977d2875fe 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -687,7 +687,7 @@ int virNetSocketNewConnectUNIX(const char *path,
     if (spawnDaemon) {
         g_autofree char *binname = NULL;
 
-        if (spawnDaemon && !binary) {
+        if (!binary) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("Auto-spawn of daemon requested, "
                              "but no binary specified"));
diff --git a/src/util/virlease.c b/src/util/virlease.c
index 1cb9540d80..aeb605862f 100644
--- a/src/util/virlease.c
+++ b/src/util/virlease.c
@@ -244,7 +244,7 @@ virLeaseNew(virJSONValuePtr *lease_ret,
         return -1;
     if (ip && virJSONValueObjectAppendString(lease_new, "ip-address", ip) < 0)
         return -1;
-    if (mac && virJSONValueObjectAppendString(lease_new, "mac-address", mac) < 0)
+    if (virJSONValueObjectAppendString(lease_new, "mac-address", mac) < 0)
         return -1;
     if (hostname && virJSONValueObjectAppendString(lease_new, "hostname", hostname) < 0)
         return -1;
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 15f8eb074a..bdbb929ad6 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -1201,7 +1201,7 @@ vboxAttachDrives(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine)
             if (disk->src->readonly) {
                 gVBoxAPI.UIMedium.SetType(medium, MediumType_Immutable);
                 VIR_DEBUG("Setting hard disk to immutable");
-            } else if (!disk->src->readonly) {
+            } else {
                 gVBoxAPI.UIMedium.SetType(medium, MediumType_Normal);
                 VIR_DEBUG("Setting hard disk type to normal");
             }
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux