From 22833787ce209d7deace45f77aef6a03d45b18ea Mon Sep 17 00:00:00 2001 From: Jason Chen CJ Date: Mon, 2 Jul 2018 16:38:21 +0800 Subject: [PATCH] refine definition for foreach_vcpu foreach_vcpu will go through all vcpu_array and only call the following code when vcpu != NULL Signed-off-by: Jason Chen CJ Reviewed-by: Zhao Yakui Acked-by: Eddie Dong --- hypervisor/include/arch/x86/guest/guest.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hypervisor/include/arch/x86/guest/guest.h b/hypervisor/include/arch/x86/guest/guest.h index 32070beeb..dc4711aba 100644 --- a/hypervisor/include/arch/x86/guest/guest.h +++ b/hypervisor/include/arch/x86/guest/guest.h @@ -20,9 +20,9 @@ #define foreach_vcpu(idx, vm, vcpu) \ for (idx = 0U, vcpu = vm->hw.vcpu_array[idx]; \ - (idx < vm->hw.num_vcpus) && (vcpu != NULL); \ - idx++, vcpu = vm->hw.vcpu_array[idx]) - + idx < vm->hw.num_vcpus; \ + idx++, vcpu = vm->hw.vcpu_array[idx]) \ + if (vcpu) /* the index is matched with emulated msrs array*/ #define IDX_TSC_DEADLINE 0U