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:
Michal Privoznik 2019-02-27 15:03:10 +01:00
parent 4ec3cf9a0f
commit ab2e90006d
6 changed files with 16 additions and 23 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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",

View File

@ -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);

View File

@ -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;

View File

@ -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);