[libvirt PATCH 08/16] virDomainFeaturesKVMDefParse: Remove tautological "if"

Tim Wiederhake posted 16 patches 3 years, 4 months ago
[libvirt PATCH 08/16] virDomainFeaturesKVMDefParse: Remove tautological "if"
Posted by Tim Wiederhake 3 years, 4 months ago
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
---
 src/conf/domain_conf.c | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 62565601ab..24529f3093 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -17404,28 +17404,26 @@ virDomainFeaturesKVMDefParse(virDomainDef *def,
 {
     def->features[VIR_DOMAIN_FEATURE_KVM] = VIR_TRISTATE_SWITCH_ON;
 
-    if (def->features[VIR_DOMAIN_FEATURE_KVM] == VIR_TRISTATE_SWITCH_ON) {
+    node = xmlFirstElementChild(node);
+    while (node) {
         int feature;
         virTristateSwitch value;
 
-        node = xmlFirstElementChild(node);
-        while (node) {
-            feature = virDomainKVMTypeFromString((const char *)node->name);
-            if (feature < 0) {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                               _("unsupported KVM feature: %s"),
-                               node->name);
-                return -1;
-            }
+        feature = virDomainKVMTypeFromString((const char *)node->name);
+        if (feature < 0) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("unsupported KVM feature: %s"),
+                           node->name);
+            return -1;
+        }
 
-            if (virXMLPropTristateSwitch(node, "state", VIR_XML_PROP_REQUIRED,
-                                         &value) < 0)
-                return -1;
+        if (virXMLPropTristateSwitch(node, "state", VIR_XML_PROP_REQUIRED,
+                                     &value) < 0)
+            return -1;
 
-            def->kvm_features[feature] = value;
+        def->kvm_features[feature] = value;
 
-            node = xmlNextElementSibling(node);
-        }
+        node = xmlNextElementSibling(node);
     }
 
     return 0;
-- 
2.31.1