From: Laine Stump Date: Wed, 12 Feb 2025 02:43:26 +0000 (-0500) Subject: hyperv: change hypervDomainDefAppendController() to return void X-Git-Tag: v11.2.0-rc1~277 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cc82b06036bdd05beeea10c1672f8701dfcf05c1;p=thirdparty%2Flibvirt.git hyperv: change hypervDomainDefAppendController() to return void It can't fail. And as a result, hypervDomainDefAppendSCSIController() and hypervDomainDefAppendIDEController() can also be changed to return void. Signed-off-by: Laine Stump Reviewed-by: Martin Kletzander --- 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;