]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Remove redundant conditions
authorJán Tomko <jtomko@redhat.com>
Sun, 2 Aug 2020 20:57:29 +0000 (22:57 +0200)
committerJán Tomko <jtomko@redhat.com>
Mon, 3 Aug 2020 13:19:28 +0000 (15:19 +0200)
All of these have been checked earlier.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/hypervisor/virhostdev.c
src/libxl/xen_xl.c
src/qemu/qemu_hotplug.c
src/qemu/qemu_process.c
src/rpc/virnetsocket.c
src/util/virlease.c
src/vbox/vbox_common.c

index 9017cc3be8cdfa8f9521d4ce7aa73b18101623f2..69102b8ebf67af80712953fbce3f08b2b4becf10 100644 (file)
@@ -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;
     }
index f9dc18ab18b208d319282ce422f46c75135c0673..e83a019bcceb1cfa9fb63db07a95b25c2d7de24f 100644 (file)
@@ -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) {
index 26912334d2813b97498f6c1766297cd84893d399..b902c1aba1699fdee8a475cd835db46617771483 100644 (file)
@@ -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 &&
index ec6ca14bbd859a36afda53e6a82ef53dbf86f1a3..e99d9f76fe46ab1870ba4793bc92ae570b5dd0b5 100644 (file)
@@ -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;
index 5a7f5019233a7719d44f13ed467d998704965210..977d2875feea61995852b4c59c037fe37c6d4772 100644 (file)
@@ -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"));
index 1cb9540d805be5d7b8dab9c733ae46b45bc48631..aeb605862f8c731a8fe917ceb03506476a9305e2 100644 (file)
@@ -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;
index 15f8eb074af9716dc0f47c0f97cbd2d809e2769a..bdbb929ad6db31f1ad816529dddfb23dd47d2ea6 100644 (file)
@@ -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");
             }