1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-04-01 20:05:19 +00:00

virnetworkobj: Drop needless cleanup label in virNetworkObjAddPort

The cleanup label in virNetworkObjAddPort() function serves no
purpose. Drop it and thus simplify the function a bit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Michal Privoznik 2019-07-09 16:51:43 +02:00
parent 37d8d6b98d
commit 6246400329

View File

@ -1625,7 +1625,6 @@ virNetworkObjAddPort(virNetworkObjPtr net,
virNetworkPortDefPtr portdef,
const char *stateDir)
{
int ret = -1;
char uuidstr[VIR_UUID_STRING_BUFLEN];
VIR_AUTOFREE(char *) dir = NULL;
@ -1635,24 +1634,21 @@ virNetworkObjAddPort(virNetworkObjPtr net,
virReportError(VIR_ERR_NETWORK_PORT_EXIST,
_("Network port with UUID %s already exists"),
uuidstr);
goto cleanup;
return -1;
}
if (!(dir = virNetworkObjGetPortStatusDir(net, stateDir)))
goto cleanup;
return -1;
if (virHashAddEntry(net->ports, uuidstr, portdef) < 0)
goto cleanup;
return -1;
if (virNetworkPortDefSaveStatus(portdef, dir) < 0) {
virHashRemoveEntry(net->ports, uuidstr);
goto cleanup;
return -1;
}
ret = 0;
cleanup:
return ret;
return 0;
}