Skip to content

Commit 2283378

Browse files
JasonChenCJlijinxia
authored andcommitted
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 <jason.cj.chen@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent 3117870 commit 2283378

File tree

1 file changed

+3
-3
lines changed
  • hypervisor/include/arch/x86/guest

1 file changed

+3
-3
lines changed

hypervisor/include/arch/x86/guest/guest.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020

2121
#define foreach_vcpu(idx, vm, vcpu) \
2222
for (idx = 0U, vcpu = vm->hw.vcpu_array[idx]; \
23-
(idx < vm->hw.num_vcpus) && (vcpu != NULL); \
24-
idx++, vcpu = vm->hw.vcpu_array[idx])
25-
23+
idx < vm->hw.num_vcpus; \
24+
idx++, vcpu = vm->hw.vcpu_array[idx]) \
25+
if (vcpu)
2626

2727
/* the index is matched with emulated msrs array*/
2828
#define IDX_TSC_DEADLINE 0U

0 commit comments

Comments
 (0)