]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
domain_capabilities: use early return in virDomainCapsFeatureSEVFormat()
authorKristina Hanicova <khanicov@redhat.com>
Thu, 21 Jul 2022 10:45:46 +0000 (12:45 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Fri, 22 Jul 2022 10:56:55 +0000 (12:56 +0200)
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/conf/domain_capabilities.c

index 33570a51db8050873469c15315c9898ca69228c4..bb36a956dbb4169f40c1bd0af8e45190aaef4151 100644 (file)
@@ -590,25 +590,24 @@ virDomainCapsFeatureSEVFormat(virBuffer *buf,
 {
     if (!sev) {
         virBufferAddLit(buf, "<sev supported='no'/>\n");
-    } else {
-        virBufferAddLit(buf, "<sev supported='yes'>\n");
-        virBufferAdjustIndent(buf, 2);
-        virBufferAsprintf(buf, "<cbitpos>%d</cbitpos>\n", sev->cbitpos);
-        virBufferAsprintf(buf, "<reducedPhysBits>%d</reducedPhysBits>\n",
-                          sev->reduced_phys_bits);
-        virBufferAsprintf(buf, "<maxGuests>%d</maxGuests>\n",
-                          sev->max_guests);
-        virBufferAsprintf(buf, "<maxESGuests>%d</maxESGuests>\n",
-                          sev->max_es_guests);
-        if (sev->cpu0_id != NULL) {
-            virBufferAsprintf(buf, "<cpu0Id>%s</cpu0Id>\n",
-                              sev->cpu0_id);
-        }
-        virBufferAdjustIndent(buf, -2);
-        virBufferAddLit(buf, "</sev>\n");
+        return;
     }
 
-    return;
+    virBufferAddLit(buf, "<sev supported='yes'>\n");
+    virBufferAdjustIndent(buf, 2);
+    virBufferAsprintf(buf, "<cbitpos>%d</cbitpos>\n", sev->cbitpos);
+    virBufferAsprintf(buf, "<reducedPhysBits>%d</reducedPhysBits>\n",
+                      sev->reduced_phys_bits);
+    virBufferAsprintf(buf, "<maxGuests>%d</maxGuests>\n",
+                      sev->max_guests);
+    virBufferAsprintf(buf, "<maxESGuests>%d</maxESGuests>\n",
+                      sev->max_es_guests);
+    if (sev->cpu0_id != NULL) {
+        virBufferAsprintf(buf, "<cpu0Id>%s</cpu0Id>\n",
+                          sev->cpu0_id);
+    }
+    virBufferAdjustIndent(buf, -2);
+    virBufferAddLit(buf, "</sev>\n");
 }