On a Tuesday in 2020, 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(-)
@@ -3190,7 +3143,7 @@ static int
networkFindUnusedBridgeName(virNetworkObjListPtr nets,
virNetworkDefPtr def)
{
- int ret = -1, id = 0;
+ int id = 0;
const char *templ = "virbr%d";
const char *p;
@@ -3211,17 +3164,14 @@ networkFindUnusedBridgeName(virNetworkObjListPtr nets,
virNetDevExists(newname) == 1)) {
VIR_FREE(def->bridge); /*could contain template */
def->bridge = g_steal_pointer(&newname);
- ret = 0;
- goto cleanup;
+ return 0;
}
} while (++id <= MAX_BRIDGE_ID);
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Bridge generation exceeded max id %d"),
MAX_BRIDGE_ID);
- ret = 0;
- cleanup:
- return ret;
+ return -1;
This fix deserves a separate commit. Or at least a mention in the commit
message.
}
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano