Re: [PATCH 20/32] bhyve: eliminate unnecessary labels

2020-07-08 Thread Ján Tomko

On a Sunday in 2020, Laine Stump wrote:

Signed-off-by: Laine Stump 
---
src/bhyve/bhyve_command.c | 25 ++---
1 file changed, 10 insertions(+), 15 deletions(-)



Reviewed-by: Ján Tomko 

Jano


signature.asc
Description: PGP signature


[PATCH 20/32] bhyve: eliminate unnecessary labels

2020-07-05 Thread Laine Stump
Signed-off-by: Laine Stump 
---
 src/bhyve/bhyve_command.c | 25 ++---
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
index 9649c2d2a2..22d0b24ec4 100644
--- a/src/bhyve/bhyve_command.c
+++ b/src/bhyve/bhyve_command.c
@@ -169,7 +169,6 @@ bhyveBuildAHCIControllerArgStr(const virDomainDef *def,
 g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
 const char *disk_source;
 size_t i;
-int ret = -1;
 
 for (i = 0; i < def->ndisks; i++) {
 g_auto(virBuffer) device = VIR_BUFFER_INITIALIZER;
@@ -187,11 +186,11 @@ bhyveBuildAHCIControllerArgStr(const virDomainDef *def,
 (virDomainDiskGetType(disk) != VIR_STORAGE_TYPE_VOLUME)) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("unsupported disk type"));
-goto error;
+return -1;
 }
 
 if (virDomainDiskTranslateSourcePool(disk) < 0)
-goto error;
+return -1;
 
 disk_source = virDomainDiskGetSource(disk);
 
@@ -200,7 +199,7 @@ bhyveBuildAHCIControllerArgStr(const virDomainDef *def,
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("cdrom device without source path "
  "not supported"));
-goto error;
+return -1;
 }
 
 switch (disk->device) {
@@ -219,7 +218,7 @@ bhyveBuildAHCIControllerArgStr(const virDomainDef *def,
 default:
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("unsupported disk device"));
-goto error;
+return -1;
 }
 virBufferAddBuffer(, );
 }
@@ -229,9 +228,7 @@ bhyveBuildAHCIControllerArgStr(const virDomainDef *def,
controller->info.addr.pci.slot,
virBufferCurrentContent());
 
-ret = 0;
- error:
-return ret;
+return 0;
 }
 
 static int
@@ -406,7 +403,7 @@ bhyveBuildGraphicsArgStr(const virDomainDef *def,
 if (!(glisten = virDomainGraphicsGetListen(graphics, 0))) {
 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Missing listen element"));
-goto error;
+return -1;
 }
 
 virBufferAsprintf(, "%d:%d,fbuf", video->info.addr.pci.slot, 
video->info.addr.pci.function);
@@ -421,13 +418,13 @@ bhyveBuildGraphicsArgStr(const virDomainDef *def,
  graphics->data.vnc.port > 65535)) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("vnc port must be in range [5900,65535]"));
-goto error;
+return -1;
 }
 
 if (graphics->data.vnc.auth.passwd) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("vnc password auth not supported"));
-goto error;
+return -1;
 } else {
  /* Bhyve doesn't support VNC Auth yet, so print a warning about
   * unauthenticated VNC sessions */
@@ -461,11 +458,11 @@ bhyveBuildGraphicsArgStr(const virDomainDef *def,
 case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE:
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Unsupported listen type"));
-goto error;
+return -1;
 case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST:
 default:
 virReportEnumRangeError(virDomainGraphicsListenType, glisten->type);
-goto error;
+return -1;
 }
 
 if (video->driver)
@@ -476,8 +473,6 @@ bhyveBuildGraphicsArgStr(const virDomainDef *def,
 virCommandAddArgBuffer(cmd, );
 return 0;
 
- error:
-return -1;
 }
 
 virCommandPtr
-- 
2.25.4