On 16/07/18 15:05, Paul Durrant wrote: >> --- a/xen/arch/x86/hvm/hvm.c >> +++ b/xen/arch/x86/hvm/hvm.c >> @@ -976,14 +976,13 @@ unsigned long hvm_cr4_guest_valid_bits(c >> >> static int hvm_load_cpu_ctxt(struct domain *d, hvm_domain_context_t *h) >> { >> - int vcpuid; >> + unsigned int vcpuid = hvm_load_instance(h); >> struct vcpu *v; >> struct hvm_hw_cpu ctxt; >> struct segment_register seg; >> const char *errstr; >> >> /* Which vcpu is this? */ >> - vcpuid = hvm_load_instance(h); >> if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL ) > This open coded pattern: > > vcpuid = hvm_load_instance(h); > if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL ) > { ... > > seems to be repeated an awful lot. Is it time, perhaps, to introduce a helper > function that incorporates the check?
In some copious free time when I can post v2 of my "fix max_vcpus" series, all of this logic (and much more) will become redundant and get culled. I really wouldn't waste time re-factoring it at this point. ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel