libxl: Remove needless labels

After previous cleanups some labels are needless: they contain
nothing but a return statement. Drop such labels and return
directly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2022-01-14 13:49:54 +01:00
parent d90cb8ff10
commit 7b9cebac22
3 changed files with 31 additions and 63 deletions

View File

@ -2313,17 +2313,14 @@ xenFormatVif(virConf *conf,
for (i = 0; i < def->nnets; i++) { for (i = 0; i < def->nnets; i++) {
if (xenFormatNet(conn, netVal, def->nets[i], if (xenFormatNet(conn, netVal, def->nets[i],
hvm, vif_typename) < 0) hvm, vif_typename) < 0)
goto cleanup; return -1;
} }
if (netVal->list != NULL && if (netVal->list != NULL &&
virConfSetValue(conf, "vif", &netVal) < 0) virConfSetValue(conf, "vif", &netVal) < 0)
goto cleanup; return -1;
return 0; return 0;
cleanup:
return -1;
} }

View File

@ -392,7 +392,6 @@ static int
xenParseXLVnuma(virConf *conf, xenParseXLVnuma(virConf *conf,
virDomainDef *def) virDomainDef *def)
{ {
int ret = -1;
size_t vcpus = 0; size_t vcpus = 0;
size_t nr_nodes = 0; size_t nr_nodes = 0;
size_t vnodeCnt = 0; size_t vnodeCnt = 0;
@ -416,7 +415,7 @@ xenParseXLVnuma(virConf *conf,
} }
if (!virDomainNumaSetNodeCount(numa, nr_nodes)) if (!virDomainNumaSetNodeCount(numa, nr_nodes))
goto cleanup; return -1;
cpu = virCPUDefNew(); cpu = virCPUDefNew();
@ -439,7 +438,7 @@ xenParseXLVnuma(virConf *conf,
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("vnuma vnode invalid format '%s'"), _("vnuma vnode invalid format '%s'"),
str); str);
goto cleanup; return -1;
} }
data++; data++;
@ -452,18 +451,18 @@ xenParseXLVnuma(virConf *conf,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("vnuma vnode %zu contains invalid pnode value '%s'"), _("vnuma vnode %zu contains invalid pnode value '%s'"),
vnodeCnt, data); vnodeCnt, data);
goto cleanup; return -1;
} }
pnode = cellid; pnode = cellid;
} else if (STRPREFIX(str, "size")) { } else if (STRPREFIX(str, "size")) {
if (virStrToLong_ull(data, NULL, 10, &kbsize) < 0) if (virStrToLong_ull(data, NULL, 10, &kbsize) < 0)
goto cleanup; return -1;
virDomainNumaSetNodeMemorySize(numa, vnodeCnt, (kbsize * 1024)); virDomainNumaSetNodeMemorySize(numa, vnodeCnt, (kbsize * 1024));
} else if (STRPREFIX(str, "vcpus")) { } else if (STRPREFIX(str, "vcpus")) {
if (virBitmapParse(data, &cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0) if (virBitmapParse(data, &cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0)
goto cleanup; return -1;
virDomainNumaSetNodeCpumask(numa, vnodeCnt, cpumask); virDomainNumaSetNodeCpumask(numa, vnodeCnt, cpumask);
vcpus += virBitmapCountBits(cpumask); vcpus += virBitmapCountBits(cpumask);
@ -474,7 +473,7 @@ xenParseXLVnuma(virConf *conf,
unsigned int value; unsigned int value;
if (!(token = g_strsplit(data, ",", 0))) if (!(token = g_strsplit(data, ",", 0)))
goto cleanup; return -1;
ndistances = g_strv_length(token); ndistances = g_strv_length(token);
@ -482,23 +481,23 @@ xenParseXLVnuma(virConf *conf,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("vnuma pnode %d configured '%s' (count %zu) doesn't fit the number of specified vnodes %zu"), _("vnuma pnode %d configured '%s' (count %zu) doesn't fit the number of specified vnodes %zu"),
pnode, str, ndistances, nr_nodes); pnode, str, ndistances, nr_nodes);
goto cleanup; return -1;
} }
if (virDomainNumaSetNodeDistanceCount(numa, vnodeCnt, ndistances) != ndistances) if (virDomainNumaSetNodeDistanceCount(numa, vnodeCnt, ndistances) != ndistances)
goto cleanup; return -1;
for (i = 0; i < ndistances; i++) { for (i = 0; i < ndistances; i++) {
if ((virStrToLong_ui(token[i], NULL, 10, &value) < 0) || if ((virStrToLong_ui(token[i], NULL, 10, &value) < 0) ||
(virDomainNumaSetNodeDistance(numa, vnodeCnt, i, value) != value)) (virDomainNumaSetNodeDistance(numa, vnodeCnt, i, value) != value))
goto cleanup; return -1;
} }
} else { } else {
virReportError(VIR_ERR_CONF_SYNTAX, virReportError(VIR_ERR_CONF_SYNTAX,
_("Invalid vnuma configuration for vnode %zu"), _("Invalid vnuma configuration for vnode %zu"),
vnodeCnt); vnodeCnt);
goto cleanup; return -1;
} }
} }
vnode = vnode->next; vnode = vnode->next;
@ -511,7 +510,7 @@ xenParseXLVnuma(virConf *conf,
virReportError(VIR_ERR_CONF_SYNTAX, virReportError(VIR_ERR_CONF_SYNTAX,
_("Incomplete vnuma configuration for vnode %zu"), _("Incomplete vnuma configuration for vnode %zu"),
vnodeCnt); vnodeCnt);
goto cleanup; return -1;
} }
list = list->next; list = list->next;
@ -525,16 +524,13 @@ xenParseXLVnuma(virConf *conf,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("vnuma configuration contains %zu vcpus, which is greater than %zu maxvcpus"), _("vnuma configuration contains %zu vcpus, which is greater than %zu maxvcpus"),
vcpus, def->maxvcpus); vcpus, def->maxvcpus);
goto cleanup; return -1;
} }
cpu->type = VIR_CPU_TYPE_GUEST; cpu->type = VIR_CPU_TYPE_GUEST;
def->cpu = g_steal_pointer(&cpu); def->cpu = g_steal_pointer(&cpu);
ret = 0; return 0;
cleanup:
return ret;
} }
static int static int
@ -571,8 +567,6 @@ xenParseXLXenbusLimits(virConf *conf, virDomainDef *def)
static int static int
xenParseXLDiskSrc(virDomainDiskDef *disk, char *srcstr) xenParseXLDiskSrc(virDomainDiskDef *disk, char *srcstr)
{ {
int ret = -1;
/* A NULL source is valid, e.g. an empty CDROM */ /* A NULL source is valid, e.g. an empty CDROM */
if (srcstr == NULL) if (srcstr == NULL)
return 0; return 0;
@ -581,19 +575,16 @@ xenParseXLDiskSrc(virDomainDiskDef *disk, char *srcstr)
g_autofree char *tmpstr = NULL; g_autofree char *tmpstr = NULL;
if (!(tmpstr = virStringReplace(srcstr, "\\\\", "\\"))) if (!(tmpstr = virStringReplace(srcstr, "\\\\", "\\")))
goto cleanup; return -1;
virDomainDiskSetType(disk, VIR_STORAGE_TYPE_NETWORK); virDomainDiskSetType(disk, VIR_STORAGE_TYPE_NETWORK);
disk->src->protocol = VIR_STORAGE_NET_PROTOCOL_RBD; disk->src->protocol = VIR_STORAGE_NET_PROTOCOL_RBD;
ret = virStorageSourceParseRBDColonString(tmpstr, disk->src); return virStorageSourceParseRBDColonString(tmpstr, disk->src);
} else {
virDomainDiskSetSource(disk, srcstr);
ret = 0;
} }
cleanup: virDomainDiskSetSource(disk, srcstr);
return ret;
return 0;
} }
@ -1396,7 +1387,7 @@ xenFormatXLDomainVnuma(virConf *conf,
nr_nodes = virDomainNumaGetNodeCount(numa); nr_nodes = virDomainNumaGetNodeCount(numa);
for (i = 0; i < nr_nodes; i++) { for (i = 0; i < nr_nodes; i++) {
if (xenFormatXLVnuma(vnumaVal, numa, i, nr_nodes) < 0) if (xenFormatXLVnuma(vnumaVal, numa, i, nr_nodes) < 0)
goto cleanup; return -1;
} }
if (vnumaVal->list != NULL && if (vnumaVal->list != NULL &&
@ -1404,9 +1395,6 @@ xenFormatXLDomainVnuma(virConf *conf,
return -1; return -1;
return 0; return 0;
cleanup:
return -1;
} }
static int static int
@ -1643,7 +1631,7 @@ xenFormatXLDomainDisks(virConf *conf, virDomainDef *def)
continue; continue;
if (xenFormatXLDisk(diskVal, def->disks[i]) < 0) if (xenFormatXLDisk(diskVal, def->disks[i]) < 0)
goto cleanup; return -1;
} }
if (diskVal->list != NULL && if (diskVal->list != NULL &&
@ -1651,9 +1639,6 @@ xenFormatXLDomainDisks(virConf *conf, virDomainDef *def)
return -1; return -1;
return 0; return 0;
cleanup:
return -1;
} }
@ -1760,7 +1745,7 @@ xenFormatXLInputDevs(virConf *conf, virDomainDef *def)
for (i = 0; i < def->ninputs; i++) { for (i = 0; i < def->ninputs; i++) {
if (def->inputs[i]->bus == VIR_DOMAIN_INPUT_BUS_USB) { if (def->inputs[i]->bus == VIR_DOMAIN_INPUT_BUS_USB) {
if (xenConfigSetInt(conf, "usb", 1) < 0) if (xenConfigSetInt(conf, "usb", 1) < 0)
goto error; return -1;
switch (def->inputs[i]->type) { switch (def->inputs[i]->type) {
case VIR_DOMAIN_INPUT_TYPE_MOUSE: case VIR_DOMAIN_INPUT_TYPE_MOUSE:
@ -1792,17 +1777,15 @@ xenFormatXLInputDevs(virConf *conf, virDomainDef *def)
/* for compatibility with Xen <= 4.2, use old syntax when /* for compatibility with Xen <= 4.2, use old syntax when
* only one device present */ * only one device present */
if (xenConfigSetString(conf, "usbdevice", usbdevices->list->str) < 0) if (xenConfigSetString(conf, "usbdevice", usbdevices->list->str) < 0)
goto error; return -1;
} else { } else {
if (virConfSetValue(conf, "usbdevice", &usbdevices) < 0) if (virConfSetValue(conf, "usbdevice", &usbdevices) < 0)
goto error; return -1;
} }
} }
} }
return 0; return 0;
error:
return -1;
} }
static int static int
@ -1845,7 +1828,7 @@ xenFormatXLUSBController(virConf *conf,
break; break;
default: default:
goto error; return -1;
} }
} }
@ -1871,9 +1854,6 @@ xenFormatXLUSBController(virConf *conf,
return -1; return -1;
return 0; return 0;
error:
return -1;
} }
@ -1991,17 +1971,14 @@ xenFormatXLDomainChannels(virConf *conf, virDomainDef *def)
continue; continue;
if (xenFormatXLChannel(channelVal, def->channels[i]) < 0) if (xenFormatXLChannel(channelVal, def->channels[i]) < 0)
goto cleanup; return -1;
} }
if (channelVal->list != NULL && if (channelVal->list != NULL &&
virConfSetValue(conf, "channel", &channelVal) < 0) virConfSetValue(conf, "channel", &channelVal) < 0)
goto cleanup; return -1;
return 0; return 0;
cleanup:
return -1;
} }
static int static int
@ -2041,12 +2018,9 @@ xenFormatXLDomainNamespaceData(virConf *conf, virDomainDef *def)
if (args->list != NULL && if (args->list != NULL &&
virConfSetValue(conf, "device_model_args", &args) < 0) virConfSetValue(conf, "device_model_args", &args) < 0)
goto error; return -1;
return 0; return 0;
error:
return -1;
} }
virConf * virConf *

View File

@ -353,17 +353,14 @@ xenFormatXMDisks(virConf *conf, virDomainDef *def)
continue; continue;
if (xenFormatXMDisk(diskVal, def->disks[i]) < 0) if (xenFormatXMDisk(diskVal, def->disks[i]) < 0)
goto cleanup; return -1;
} }
if (diskVal->list != NULL && if (diskVal->list != NULL &&
virConfSetValue(conf, "disk", &diskVal) < 0) virConfSetValue(conf, "disk", &diskVal) < 0)
goto cleanup; return -1;
return 0; return 0;
cleanup:
return -1;
} }