mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 05:17:59 +03:00
Drop some useless comparisons and checks
In these cases the check that is removed has been done a few lines above already (as can even be seen in the context). Drop them. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
4ec3cf9a0f
commit
ab2e90006d
@ -79,8 +79,7 @@ main(int argc, char *argv[])
|
||||
cleanup:
|
||||
if (dom != NULL)
|
||||
virDomainFree(dom);
|
||||
if (conn != NULL)
|
||||
virConnectClose(conn);
|
||||
virConnectClose(conn);
|
||||
|
||||
out:
|
||||
return ret;
|
||||
|
@ -2659,10 +2659,8 @@ virNWFilterDefParseXML(xmlXPathContextPtr ctxt)
|
||||
ret->chainPriority = chain_priority;
|
||||
} else {
|
||||
/* assign default priority if none can be found via lookup */
|
||||
if (!name_prefix ||
|
||||
intMapGetByString(chain_priorities, name_prefix, 0,
|
||||
&ret->chainPriority) < 0) {
|
||||
/* assign default chain priority */
|
||||
if (intMapGetByString(chain_priorities, name_prefix,
|
||||
0, &ret->chainPriority) < 0) {
|
||||
ret->chainPriority = (NWFILTER_MAX_FILTER_PRIORITY +
|
||||
NWFILTER_MIN_FILTER_PRIORITY) / 2;
|
||||
}
|
||||
|
@ -4340,8 +4340,7 @@ qemuBuildNVRAMCommandLine(virCommandPtr cmd,
|
||||
optstr = qemuBuildNVRAMDevStr(def->nvram);
|
||||
if (!optstr)
|
||||
return -1;
|
||||
if (optstr)
|
||||
virCommandAddArg(cmd, optstr);
|
||||
virCommandAddArg(cmd, optstr);
|
||||
VIR_FREE(optstr);
|
||||
} else {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
|
@ -3521,17 +3521,15 @@ qemuDomainChangeNetBridge(virDomainObjPtr vm,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (oldbridge) {
|
||||
ret = virNetDevBridgeRemovePort(oldbridge, olddev->ifname);
|
||||
virDomainAuditNet(vm, olddev, NULL, "detach", ret == 0);
|
||||
if (ret < 0) {
|
||||
/* warn but continue - possibly the old network
|
||||
* had been destroyed and reconstructed, leaving the
|
||||
* tap device orphaned.
|
||||
*/
|
||||
VIR_WARN("Unable to detach device %s from bridge %s",
|
||||
olddev->ifname, oldbridge);
|
||||
}
|
||||
ret = virNetDevBridgeRemovePort(oldbridge, olddev->ifname);
|
||||
virDomainAuditNet(vm, olddev, NULL, "detach", ret == 0);
|
||||
if (ret < 0) {
|
||||
/* warn but continue - possibly the old network
|
||||
* had been destroyed and reconstructed, leaving the
|
||||
* tap device orphaned.
|
||||
*/
|
||||
VIR_WARN("Unable to detach device %s from bridge %s",
|
||||
olddev->ifname, oldbridge);
|
||||
}
|
||||
|
||||
ret = virNetDevBridgeAddPort(newbridge, olddev->ifname);
|
||||
|
@ -2120,7 +2120,7 @@ virResctrlAllocMemoryBandwidth(virResctrlInfoPtr resctrl,
|
||||
if (!mem_bw_alloc)
|
||||
return 0;
|
||||
|
||||
if (mem_bw_alloc && !mem_bw_info) {
|
||||
if (!mem_bw_info) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("RDT Memory Bandwidth allocation unsupported"));
|
||||
return -1;
|
||||
|
@ -1208,9 +1208,8 @@ virshSnapshotListCollect(vshControl *ctl, virDomainPtr dom,
|
||||
/* Now that we have a count, collect the list. */
|
||||
if (from && !priv->useSnapshotOld) {
|
||||
if (tree) {
|
||||
if (count)
|
||||
count = virDomainSnapshotListChildrenNames(from, names + 1,
|
||||
count - 1, flags);
|
||||
count = virDomainSnapshotListChildrenNames(from, names + 1,
|
||||
count - 1, flags);
|
||||
if (count >= 0) {
|
||||
count++;
|
||||
names[0] = vshStrdup(ctl, fromname);
|
||||
|
Loading…
Reference in New Issue
Block a user