提交 5d5f7183 编写于 作者: J John Ferlan

nwfilter: Clean up a couple nwfilter_driver error paths

No need to goto cleanup and check "if (obj)" if we know (obj) isn't there,
so just return immediately.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 f7ecae61
...@@ -391,7 +391,7 @@ nwfilterLookupByUUID(virConnectPtr conn, ...@@ -391,7 +391,7 @@ nwfilterLookupByUUID(virConnectPtr conn,
nwfilterDriverUnlock(); nwfilterDriverUnlock();
if (!obj) if (!obj)
goto cleanup; return NULL;
def = virNWFilterObjGetDef(obj); def = virNWFilterObjGetDef(obj);
if (virNWFilterLookupByUUIDEnsureACL(conn, def) < 0) if (virNWFilterLookupByUUIDEnsureACL(conn, def) < 0)
...@@ -400,7 +400,6 @@ nwfilterLookupByUUID(virConnectPtr conn, ...@@ -400,7 +400,6 @@ nwfilterLookupByUUID(virConnectPtr conn,
ret = virGetNWFilter(conn, def->name, def->uuid); ret = virGetNWFilter(conn, def->name, def->uuid);
cleanup: cleanup:
if (obj)
virNWFilterObjUnlock(obj); virNWFilterObjUnlock(obj);
return ret; return ret;
} }
...@@ -421,7 +420,7 @@ nwfilterLookupByName(virConnectPtr conn, ...@@ -421,7 +420,7 @@ nwfilterLookupByName(virConnectPtr conn,
if (!obj) { if (!obj) {
virReportError(VIR_ERR_NO_NWFILTER, virReportError(VIR_ERR_NO_NWFILTER,
_("no nwfilter with matching name '%s'"), name); _("no nwfilter with matching name '%s'"), name);
goto cleanup; return NULL;
} }
def = virNWFilterObjGetDef(obj); def = virNWFilterObjGetDef(obj);
...@@ -431,7 +430,6 @@ nwfilterLookupByName(virConnectPtr conn, ...@@ -431,7 +430,6 @@ nwfilterLookupByName(virConnectPtr conn,
ret = virGetNWFilter(conn, def->name, def->uuid); ret = virGetNWFilter(conn, def->name, def->uuid);
cleanup: cleanup:
if (obj)
virNWFilterObjUnlock(obj); virNWFilterObjUnlock(obj);
return ret; return ret;
} }
...@@ -594,7 +592,7 @@ nwfilterGetXMLDesc(virNWFilterPtr nwfilter, ...@@ -594,7 +592,7 @@ nwfilterGetXMLDesc(virNWFilterPtr nwfilter,
nwfilterDriverUnlock(); nwfilterDriverUnlock();
if (!obj) if (!obj)
goto cleanup; return NULL;
def = virNWFilterObjGetDef(obj); def = virNWFilterObjGetDef(obj);
if (virNWFilterGetXMLDescEnsureACL(nwfilter->conn, def) < 0) if (virNWFilterGetXMLDescEnsureACL(nwfilter->conn, def) < 0)
...@@ -603,7 +601,6 @@ nwfilterGetXMLDesc(virNWFilterPtr nwfilter, ...@@ -603,7 +601,6 @@ nwfilterGetXMLDesc(virNWFilterPtr nwfilter,
ret = virNWFilterDefFormat(def); ret = virNWFilterDefFormat(def);
cleanup: cleanup:
if (obj)
virNWFilterObjUnlock(obj); virNWFilterObjUnlock(obj);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册