There are two compound conditions in qemuBuildMemoryBackendProps() and each one checks for nodemask for NULL first. Join them into one bigger block. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> Reviewed-by: Kristina Hanicova <khanicov@xxxxxxxxxx> --- src/qemu/qemu_command.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 929bcc0be1..b0cb252d0b 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3437,19 +3437,21 @@ qemuBuildMemoryBackendProps(virJSONValue **backendProps, return -1; } - /* Make sure the requested nodeset is sensible */ - if (nodemask && !virNumaNodesetIsAvailable(nodemask)) - return -1; - - /* If mode is "restrictive", we should only use cgroups setting allowed memory - * nodes, and skip passing the host-nodes and policy parameters to QEMU command - * line which means we will use system default memory policy. */ - if (nodemask && mode != VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) { - if (virJSONValueObjectAdd(&props, - "m:host-nodes", nodemask, - "S:policy", qemuNumaPolicyTypeToString(mode), - NULL) < 0) + if (nodemask) { + /* Make sure the requested nodeset is sensible */ + if (!virNumaNodesetIsAvailable(nodemask)) return -1; + + /* If mode is "restrictive", we should only use cgroups setting allowed memory + * nodes, and skip passing the host-nodes and policy parameters to QEMU command + * line which means we will use system default memory policy. */ + if (mode != VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) { + if (virJSONValueObjectAdd(&props, + "m:host-nodes", nodemask, + "S:policy", qemuNumaPolicyTypeToString(mode), + NULL) < 0) + return -1; + } } /* If none of the following is requested... */ -- 2.39.2