If we get to the bottom of the function we know that none of the attempts to locate a QEMU binary has been successful, so we can simply return NULL directly. This makes it unnecessary variable used to store the path, for which we can use a more descriptive name. Lastly, comparing with NULL explicitly is somewhat uncommon in libvirt and more verbose than the equivalent implicit comparison, so get rid of it. Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> --- src/qemu/qemu_capabilities.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 6b4ed08499..68edf94ba5 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -919,7 +919,7 @@ static char * virQEMUCapsFindBinaryForArch(virArch hostarch, virArch guestarch) { - char *ret = NULL; + char *binary; const char *archstr; virArch target; @@ -928,24 +928,24 @@ virQEMUCapsFindBinaryForArch(virArch hostarch, * to avoid using qemu-system-arm (and thus TCG) instead */ if (hostarch == VIR_ARCH_AARCH64 && guestarch == VIR_ARCH_ARMV7L) { archstr = virQEMUCapsArchToString(hostarch); - if ((ret = virQEMUCapsFindBinary("qemu-system-%s", archstr)) != NULL) - return ret; + if ((binary = virQEMUCapsFindBinary("qemu-system-%s", archstr))) + return binary; } /* First attempt: try the guest architecture as it is */ archstr = virQEMUCapsArchToString(guestarch); - if ((ret = virQEMUCapsFindBinary("qemu-system-%s", archstr)) != NULL) - return ret; + if ((binary = virQEMUCapsFindBinary("qemu-system-%s", archstr))) + return binary; /* Second attempt: try looking up by target instead */ target = virQEMUCapsFindTarget(hostarch, guestarch); if (target != guestarch) { archstr = virQEMUCapsArchToString(target); - if ((ret = virQEMUCapsFindBinary("qemu-system-%s", archstr)) != NULL) - return ret; + if ((binary = virQEMUCapsFindBinary("qemu-system-%s", archstr))) + return binary; } - return ret; + return NULL; } -- 2.35.1