It can't fail. And as a result, hypervDomainDefAppendSCSIController() and
hypervDomainDefAppendIDEController() can also be changed to return void.

Signed-off-by: Laine Stump <la...@redhat.com>
---
 src/hyperv/hyperv_driver.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index 66286cc756..0d1e388c08 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -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;
-- 
2.47.1

Reply via email to