diff options
author | Peter Krempa <pkrempa@redhat.com> | 2021-03-03 10:20:00 +0100 |
---|---|---|
committer | Peter Krempa <pkrempa@redhat.com> | 2021-03-05 15:33:34 +0100 |
commit | 3b5eab6e250d395681725d64d8bfe1094d4a4436 (patch) | |
tree | 0e3b39a87243e87b3d2e220f0febce3174d68f7b /src/vmx | |
parent | f9eec3714c986212c66889ff1b3886548e7445ea (diff) | |
download | libvirt-3b5eab6e250d395681725d64d8bfe1094d4a4436.tar.gz |
virIndexToDiskName: Make 'idx' unsigned and remove check
We can remove the check that 'idx' is negative by forcing callers to
pass unsigned numbers, which they do already or have a check that 'idx'
is positive.
This in turn allows us to remove most return value NULL checks.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Diffstat (limited to 'src/vmx')
-rw-r--r-- | src/vmx/vmx.c | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 73bf7c4f3d..76d01a36de 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -2217,9 +2217,6 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con (*def)->dst = virIndexToDiskName (controllerOrBus * 15 + (unit < 7 ? unit : unit - 1), "sd"); - - if ((*def)->dst == NULL) - goto cleanup; } else if (busType == VIR_DOMAIN_DISK_BUS_SATA) { if (controllerOrBus < 0 || controllerOrBus > 3) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -2238,9 +2235,6 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con prefix = g_strdup_printf("sata%d:%d", controllerOrBus, unit); (*def)->dst = virIndexToDiskName(controllerOrBus * 30 + unit, "sd"); - - if ((*def)->dst == NULL) - goto cleanup; } else if (busType == VIR_DOMAIN_DISK_BUS_IDE) { if (controllerOrBus < 0 || controllerOrBus > 1) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -2258,9 +2252,6 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con prefix = g_strdup_printf("ide%d:%d", controllerOrBus, unit); (*def)->dst = virIndexToDiskName(controllerOrBus * 2 + unit, "hd"); - - if ((*def)->dst == NULL) - goto cleanup; } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported bus type '%s' for device type '%s'"), @@ -2287,9 +2278,6 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con prefix = g_strdup_printf("floppy%d", unit); (*def)->dst = virIndexToDiskName(unit, "fd"); - - if ((*def)->dst == NULL) - goto cleanup; } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported bus type '%s' for device type '%s'"), |