qemu: agent: remove impossible errors

For both 'ip_addr_arr' and 'ret_array', we:
1) already checked that they are arrays
2) only iterate up to the array size

Remove the duplicate checks.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
This commit is contained in:
Ján Tomko 2020-10-05 21:21:07 +02:00
parent 33fd3cbeb6
commit b5c281e81b

View File

@ -2160,13 +2160,6 @@ qemuAgentGetInterfaces(qemuAgentPtr agent,
const char *hwaddr, *ifname_s, *name = NULL;
virDomainInterfacePtr iface = NULL;
/* Shouldn't happen but doesn't hurt to check neither */
if (!tmp_iface) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("qemu agent reply missing interface entry in array"));
goto error;
}
/* interface name is required to be presented */
name = virJSONValueObjectGetString(tmp_iface, "name");
if (!name) {
@ -2229,13 +2222,6 @@ qemuAgentGetInterfaces(qemuAgentPtr agent,
ip_addr = &iface->addrs[addrs_count - 1];
/* Shouldn't happen but doesn't hurt to check neither */
if (!ip_addr_obj) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("qemu agent reply missing IP addr in array"));
goto error;
}
if (qemuAgentGetInterfaceOneAddress(ip_addr, ip_addr_obj, name) < 0)
goto error;
}