1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 06:50:22 +03:00

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 <laine@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Laine Stump 2025-02-11 21:43:26 -05:00
parent e207c9c17e
commit cc82b06036

View 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;