This function always returns zero, so it might as well be void. Signed-off-by: Matt Coleman <matt@xxxxxxxxx> --- src/conf/domain_conf.c | 81 +++++++++++++----------------------------- 1 file changed, 25 insertions(+), 56 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 26630884ac..04f4cd5114 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7488,7 +7488,7 @@ virDomainVirtioOptionsFormat(virBufferPtr buf, } -static int ATTRIBUTE_NONNULL(2) +static void ATTRIBUTE_NONNULL(2) virDomainDeviceInfoFormat(virBufferPtr buf, virDomainDeviceInfoPtr info, unsigned int flags) @@ -7539,7 +7539,7 @@ virDomainDeviceInfoFormat(virBufferPtr buf, if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE || info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) /* We're done here */ - return 0; + return; virBufferAsprintf(&attrBuf, " type='%s'", virDomainDeviceAddressTypeToString(info->type)); @@ -7634,8 +7634,6 @@ virDomainDeviceInfoFormat(virBufferPtr buf, } virXMLFormatElement(buf, "address", &attrBuf, &childBuf); - - return 0; } static int @@ -25909,10 +25907,7 @@ virDomainDiskDefFormat(virBufferPtr buf, if (def->src->encryption && def->diskElementEnc && virStorageEncryptionFormat(buf, def->src->encryption) < 0) return -1; - if (virDomainDeviceInfoFormat(buf, &def->info, - flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT) < 0) { - return -1; - } + virDomainDeviceInfoFormat(buf, &def->info, flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT); if (virDomainDiskDefFormatPrivateData(buf, def, flags, xmlopt) < 0) return -1; @@ -26113,8 +26108,7 @@ virDomainControllerDefFormat(virBufferPtr buf, if (virDomainControllerDriverFormat(&childBuf, def) < 0) return -1; - if (virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(&childBuf, &def->info, flags); if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI && def->opts.pciopts.pcihole64) { @@ -26287,8 +26281,7 @@ virDomainFSDefFormat(virBufferPtr buf, if (def->readonly) virBufferAddLit(buf, "<readonly/>\n"); - if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(buf, &def->info, flags); if (def->space_hard_limit) virBufferAsprintf(buf, "<space_hard_limit unit='bytes'>" @@ -27179,11 +27172,8 @@ virDomainNetDefFormat(virBufferPtr buf, virDomainNetDefCoalesceFormatXML(buf, def->coalesce); - if (virDomainDeviceInfoFormat(buf, &def->info, - flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT - | VIR_DOMAIN_DEF_FORMAT_ALLOW_ROM) < 0) { - return -1; - } + virDomainDeviceInfoFormat(buf, &def->info, flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT + | VIR_DOMAIN_DEF_FORMAT_ALLOW_ROM); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "</interface>\n"); @@ -27482,8 +27472,7 @@ virDomainChrDefFormat(virBufferPtr buf, if (virDomainChrTargetDefFormat(buf, def, flags) < 0) return -1; - if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(buf, &def->info, flags); virBufferAdjustIndent(buf, -2); virBufferAsprintf(buf, "</%s>\n", elementName); @@ -27529,8 +27518,7 @@ virDomainSmartcardDefFormat(virBufferPtr buf, _("unexpected smartcard type %d"), def->type); return -1; } - if (virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(&childBuf, &def->info, flags); virBufferAsprintf(buf, "<smartcard mode='%s'", mode); if (def->type == VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH && @@ -27605,8 +27593,7 @@ virDomainTPMDefFormat(virBufferPtr buf, break; } - if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(buf, &def->info, flags); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "</tpm>\n"); @@ -27636,8 +27623,7 @@ virDomainSoundDefFormat(virBufferPtr buf, if (def->audioId > 0) virBufferAsprintf(&childBuf, "<audio id='%d'/>\n", def->audioId); - if (virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(&childBuf, &def->info, flags); virBufferAsprintf(buf, "<sound model='%s'", model); if (virBufferUse(&childBuf)) { @@ -27719,8 +27705,7 @@ virDomainMemballoonDefFormat(virBufferPtr buf, if (def->period) virBufferAsprintf(&childrenBuf, "<stats period='%i'/>\n", def->period); - if (virDomainDeviceInfoFormat(&childrenBuf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(&childrenBuf, &def->info, flags); virDomainVirtioOptionsFormat(&driverAttrBuf, def->virtio); @@ -27737,8 +27722,7 @@ virDomainNVRAMDefFormat(virBufferPtr buf, { virBufferAddLit(buf, "<nvram>\n"); virBufferAdjustIndent(buf, 2); - if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(buf, &def->info, flags); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "</nvram>\n"); @@ -27769,8 +27753,7 @@ virDomainWatchdogDefFormat(virBufferPtr buf, virBufferAsprintf(&attrBuf, " model='%s' action='%s'", model, action); - if (virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(&childBuf, &def->info, flags); virXMLFormatElement(buf, "watchdog", &attrBuf, &childBuf); @@ -27787,8 +27770,7 @@ static int virDomainPanicDefFormat(virBufferPtr buf, virBufferAsprintf(&attrBuf, " model='%s'", virDomainPanicModelTypeToString(def->model)); - if (virDomainDeviceInfoFormat(&childrenBuf, &def->info, 0) < 0) - return -1; + virDomainDeviceInfoFormat(&childrenBuf, &def->info, 0); virXMLFormatElement(buf, "panic", &attrBuf, &childrenBuf); @@ -27830,8 +27812,7 @@ virDomainShmemDefFormat(virBufferPtr buf, virBufferAddLit(buf, "/>\n"); } - if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(buf, &def->info, flags); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "</shmem>\n"); @@ -27886,8 +27867,7 @@ virDomainRNGDefFormat(virBufferPtr buf, virXMLFormatElement(buf, "driver", &driverAttrBuf, NULL); - if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(buf, &def->info, flags); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "</rng>\n"); @@ -28023,8 +28003,7 @@ virDomainMemoryDefFormat(virBufferPtr buf, virDomainMemoryTargetDefFormat(buf, def); - if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(buf, &def->info, flags); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "</memory>\n"); @@ -28117,8 +28096,7 @@ virDomainVideoDefFormat(virBufferPtr buf, virBufferAddLit(buf, "/>\n"); } - if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(buf, &def->info, flags); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "</video>\n"); @@ -28174,8 +28152,7 @@ virDomainInputDefFormat(virBufferPtr buf, virXMLFormatElement(&childBuf, "driver", &driverAttrBuf, NULL); virBufferEscapeString(&childBuf, "<source evdev='%s'/>\n", def->source.evdev); - if (virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(&childBuf, &def->info, flags); virXMLFormatElement(buf, "input", &attrBuf, &childBuf); @@ -28786,11 +28763,8 @@ virDomainHostdevDefFormat(virBufferPtr buf, if (def->shareable) virBufferAddLit(buf, "<shareable/>\n"); - if (virDomainDeviceInfoFormat(buf, def->info, - flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT - | VIR_DOMAIN_DEF_FORMAT_ALLOW_ROM) < 0) { - return -1; - } + virDomainDeviceInfoFormat(buf, def->info, flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT + | VIR_DOMAIN_DEF_FORMAT_ALLOW_ROM); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "</hostdev>\n"); @@ -28816,10 +28790,7 @@ virDomainRedirdevDefFormat(virBufferPtr buf, if (virDomainChrSourceDefFormat(buf, def->source, flags) < 0) return -1; - if (virDomainDeviceInfoFormat(buf, &def->info, - flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT) < 0) { - return -1; - } + virDomainDeviceInfoFormat(buf, &def->info, flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "</redirdev>\n"); return 0; @@ -28879,8 +28850,7 @@ virDomainHubDefFormat(virBufferPtr buf, return -1; } - if (virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0) - return -1; + virDomainDeviceInfoFormat(&childBuf, &def->info, flags); virBufferAsprintf(&attrBuf, " type='%s'", type); @@ -29543,8 +29513,7 @@ virDomainVsockDefFormat(virBufferPtr buf, virBufferAsprintf(&cidAttrBuf, " address='%u'", vsock->guest_cid); virXMLFormatElement(&childBuf, "cid", &cidAttrBuf, NULL); - if (virDomainDeviceInfoFormat(&childBuf, &vsock->info, 0) < 0) - return -1; + virDomainDeviceInfoFormat(&childBuf, &vsock->info, 0); virXMLFormatElement(buf, "vsock", &attrBuf, &childBuf); -- 2.27.0