On 7/7/20 5:08 PM, Laine Stump wrote:
All these cleanup/error labels were reduced to having just
"return
ret" by a previous patch, so get rid of them and return directly.
Signed-off-by: Laine Stump <laine(a)redhat.com>
---
src/network/bridge_driver.c | 264 ++++++++++++------------------
src/network/bridge_driver_linux.c | 15 +-
2 files changed, 113 insertions(+), 166 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 31bd0dd92c..79b2ca3330 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
[...]
Coverity noted there's a leak with this part of the change for @field...
@@ -2207,7 +2164,6 @@ networkSetIPv6Sysctls(virNetworkObjPtr obj)
{
virNetworkDefPtr def = virNetworkObjGetDef(obj);
g_autofree char *field = NULL;
- int ret = -1;
bool enableIPv6 = !!virNetworkDefGetIPByIndex(def, AF_INET6, 0);
/* set disable_ipv6 if there are no ipv6 addresses defined for the
@@ -2221,15 +2177,14 @@ networkSetIPv6Sysctls(virNetworkObjPtr obj)
if (!enableIPv6)
VIR_DEBUG("ipv6 appears to already be disabled on %s",
def->bridge);
- ret = 0;
- goto cleanup;
+ return 0;
}
Below here doesn't match w/ current source, but I assume you know that.
Looks like a mis-merge with the review from the previous patch.
if (virFileWriteStr(field, enableIPv6 ? "0" : "1", 0) < 0) {
virReportSystemError(errno,
_("cannot write to %s to enable/disable IPv6 "
"on bridge %s"), field, def->bridge);
- goto cleanup;
+ return -1;
}
/* The rest of the ipv6 sysctl tunables should always be set the
@@ -2246,7 +2201,7 @@ networkSetIPv6Sysctls(virNetworkObjPtr obj)
if (virFileWriteStr(field, "0", 0) < 0) {
virReportSystemError(errno,
_("cannot disable %s"), field);
- goto cleanup;
+ return -1;
}
/* All interfaces used as a gateway (which is what this is, by
@@ -2258,12 +2213,10 @@ networkSetIPv6Sysctls(virNetworkObjPtr obj)
if (virFileWriteStr(field, "0", 0) < 0) {
virReportSystemError(errno,
_("cannot disable %s"), field);
- goto cleanup;
+ return -1;
}
- ret = 0;
- cleanup:
- return ret;
+ return 0;
}
[...]