qemu_monitor_json: Drop redundant checks

In these functions I'm fixing here, we do call
qemuMonitorJSONCheckError() followed by another check if qemu
reply contains 'return' object. If it wouldn't, the former
CheckError() function would error out and the flow would not even
get to the latter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik 2016-05-03 10:55:41 +02:00
parent 3af8186898
commit e2ac519cd2

View File

@ -1093,11 +1093,7 @@ qemuMonitorJSONHumanCommandWithFd(qemuMonitorPtr mon,
if (qemuMonitorJSONCheckError(cmd, reply)) if (qemuMonitorJSONCheckError(cmd, reply))
goto cleanup; goto cleanup;
if (!(obj = virJSONValueObjectGet(reply, "return"))) { obj = virJSONValueObjectGet(reply, "return");
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("human monitor command was missing return data"));
goto cleanup;
}
if (reply_str) { if (reply_str) {
const char *data; const char *data;
@ -2539,12 +2535,7 @@ qemuMonitorJSONGetMigrationCompression(qemuMonitorPtr mon,
if ((ret = qemuMonitorJSONCheckError(cmd, reply)) < 0) if ((ret = qemuMonitorJSONCheckError(cmd, reply)) < 0)
goto cleanup; goto cleanup;
if (!(result = virJSONValueObjectGet(reply, "return"))) { result = virJSONValueObjectGet(reply, "return");
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("query-migrate-parameters reply was missing "
"'return' data"));
goto cleanup;
}
if (virJSONValueObjectGetNumberInt(result, "compress-level", if (virJSONValueObjectGetNumberInt(result, "compress-level",
&compress->level) < 0) { &compress->level) < 0) {
@ -5395,11 +5386,7 @@ int qemuMonitorJSONGetObjectProperty(qemuMonitorPtr mon,
ret = -1; ret = -1;
if (!(data = virJSONValueObjectGet(reply, "return"))) { data = virJSONValueObjectGet(reply, "return");
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("qom-get reply was missing return data"));
goto cleanup;
}
switch ((qemuMonitorJSONObjectPropertyType) prop->type) { switch ((qemuMonitorJSONObjectPropertyType) prop->type) {
/* Simple cases of boolean, int, long, uint, ulong, double, and string /* Simple cases of boolean, int, long, uint, ulong, double, and string