]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
hyperv: change hypervDomainDefAppendController() to return void
authorLaine Stump <laine@redhat.com>
Wed, 12 Feb 2025 02:43:26 +0000 (21:43 -0500)
committerLaine Stump <laine@redhat.com>
Wed, 5 Mar 2025 21:56:44 +0000 (16:56 -0500)
It can't fail. And as a result, hypervDomainDefAppendSCSIController() and
hypervDomainDefAppendIDEController() can also be changed to return void.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/hyperv/hyperv_driver.c

index 66286cc756534920bebe042038f10c946d79c440..0d1e388c08d72bd87801349e740b46de7bc9bdbd 100644 (file)
@@ -1169,7 +1169,7 @@ hypervDomainAttachSyntheticEthernetAdapter(virDomainPtr domain,
 /*
  * Functions for deserializing device entries
  */
-static int
+static void
 hypervDomainDefAppendController(virDomainDef *def,
                                 int idx,
                                 virDomainControllerType controllerType)
@@ -1178,22 +1178,20 @@ hypervDomainDefAppendController(virDomainDef *def,
 
     controller->idx = idx;
     VIR_APPEND_ELEMENT(def->controllers, def->ncontrollers, controller);
-
-    return 0;
 }
 
 
-static int
+static void
 hypervDomainDefAppendIDEController(virDomainDef *def)
 {
-    return hypervDomainDefAppendController(def, 0, VIR_DOMAIN_CONTROLLER_TYPE_IDE);
+    hypervDomainDefAppendController(def, 0, VIR_DOMAIN_CONTROLLER_TYPE_IDE);
 }
 
 
-static int
+static void
 hypervDomainDefAppendSCSIController(virDomainDef *def, int idx)
 {
-    return hypervDomainDefAppendController(def, idx, VIR_DOMAIN_CONTROLLER_TYPE_SCSI);
+    hypervDomainDefAppendController(def, idx, VIR_DOMAIN_CONTROLLER_TYPE_SCSI);
 }
 
 
@@ -1460,18 +1458,12 @@ hypervDomainDefParseStorage(hypervPrivate *priv,
             ideChannels[channel] = entry;
             if (!hasIdeController) {
                 /* Hyper-V represents its PIIX4 controller's two channels as separate objects. */
-                if (hypervDomainDefAppendIDEController(def) < 0) {
-                    virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not add IDE controller"));
-                    return -1;
-                }
+                hypervDomainDefAppendIDEController(def);
                 hasIdeController = true;
             }
         } else if (entry->data->ResourceType == MSVM_RASD_RESOURCETYPE_PARALLEL_SCSI_HBA) {
             scsiControllers[scsi_idx++] = entry;
-            if (hypervDomainDefAppendSCSIController(def, scsi_idx - 1) < 0) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not parse SCSI controller"));
-                return -1;
-            }
+            hypervDomainDefAppendSCSIController(def, scsi_idx - 1);
         }
 
         entry = entry->next;