mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu_command: Resolve Coverity DEADCODE
One useless warning, but the other one rather pertinent. On entry the 'trans' variable is initialized to VIR_DOMAIN_DISK_TRANS_DEFAULT. When the "trans" was found in the parsing loop it def->geometry.trans was assigned to the return from virDomainDiskGeometryTransTypeFromString and then 'trans' was used to do the comparison to see if it was valid. So remove 'trans' and use def->geometry.trans properly
This commit is contained in:
parent
ec10ff9eb9
commit
84bfb11b69
@ -6237,6 +6237,7 @@ qemuBuildCpuArgStr(virQEMUDriverPtr driver,
|
|||||||
def->hyperv_spinlocks);
|
def->hyperv_spinlocks);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* coverity[dead_error_begin] */
|
||||||
case VIR_DOMAIN_HYPERV_LAST:
|
case VIR_DOMAIN_HYPERV_LAST:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -9835,7 +9836,6 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
|
|||||||
int idx = -1;
|
int idx = -1;
|
||||||
int busid = -1;
|
int busid = -1;
|
||||||
int unitid = -1;
|
int unitid = -1;
|
||||||
int trans = VIR_DOMAIN_DISK_TRANS_DEFAULT;
|
|
||||||
|
|
||||||
if (qemuParseKeywords(val,
|
if (qemuParseKeywords(val,
|
||||||
&keywords,
|
&keywords,
|
||||||
@ -10054,12 +10054,12 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
|
|||||||
} else if (STREQ(keywords[i], "trans")) {
|
} else if (STREQ(keywords[i], "trans")) {
|
||||||
def->geometry.trans =
|
def->geometry.trans =
|
||||||
virDomainDiskGeometryTransTypeFromString(values[i]);
|
virDomainDiskGeometryTransTypeFromString(values[i]);
|
||||||
if ((trans < VIR_DOMAIN_DISK_TRANS_DEFAULT) ||
|
if ((def->geometry.trans < VIR_DOMAIN_DISK_TRANS_DEFAULT) ||
|
||||||
(trans >= VIR_DOMAIN_DISK_TRANS_LAST)) {
|
(def->geometry.trans >= VIR_DOMAIN_DISK_TRANS_LAST)) {
|
||||||
virDomainDiskDefFree(def);
|
virDomainDiskDefFree(def);
|
||||||
def = NULL;
|
def = NULL;
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("cannot parse translation value'%s'"),
|
_("cannot parse translation value '%s'"),
|
||||||
values[i]);
|
values[i]);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user