On Fri, May 29, 2026 at 16:12:11 +0200, Jiri Denemark via Devel wrote:
From: Jiri Denemark <jdenemar@redhat.com>
Having 'else' after goto is useless.
Well I'd argue that it's not useless, but ...
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> ---
Notes: Version 2: - no change
src/qemu/qemu_capabilities.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 0a676729b8..26b3e20d71 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4115,9 +4115,17 @@ virQEMUCapsInitHostCPUModel(virQEMUCaps *qemuCaps, if (!(cpu = virQEMUCapsNewHostCPUModel())) goto error;
- if ((rc = virQEMUCapsInitCPUModel(qemuCaps, type, cpu, false)) < 0) { + if ((rc = virQEMUCapsInitCPUModel(qemuCaps, type, cpu, false)) < 0) goto error; - } else if (rc == 1) { + + if (rc == 2) { + VIR_DEBUG("QEMU does not provide CPU model for arch=%s virttype=%s", + virArchToString(qemuCaps->arch), + virDomainVirtTypeToString(type)); + goto error; + }
... this is much clearer what's happening there. While reviewing previous patch, the WTF rate of this function was high until I realized that the return value is checked multiple times. Reviewed-by: Peter Krempa <pkrempa@redhat.com>