ret = qemuMonitorJSONCommand(mon, cmd, &reply);
- if (ret == 0) {
+ if (ret == 0)
ret = qemuMonitorJSONCheckError(cmd, reply);
- if (ret < 0)
- goto cleanup;
- }
+ if (ret < 0)
+ goto cleanup;
ret = -1;
devices = virJSONValueObjectGet(reply, "return");
if (!cmd)
return -1;
- if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
- goto cleanup;
+ ret = qemuMonitorJSONCommand(mon, cmd, &reply);
- if (qemuMonitorJSONCheckError(cmd, reply) < 0)
+ if (ret == 0)
+ ret = qemuMonitorJSONCheckError(cmd, reply);
+ if (ret < 0)
goto cleanup;
+ ret = -1;
devices = virJSONValueObjectGet(reply, "return");
if (!devices || devices->type != VIR_JSON_TYPE_ARRAY) {