|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v20 12/13] x86/hvm: Remove redundant save functions
>>> On 10.09.18 at 16:26, <aisaila@xxxxxxxxxxxxxxx> wrote:
> @@ -148,14 +146,17 @@ int hvm_save_one(struct domain *d, unsigned int
> typecode, unsigned int instance,
> !hvm_sr_handlers[typecode].save )
> return -EINVAL;
>
> + if ( instance >= d->max_vcpus &&
> + hvm_sr_handlers[typecode].kind == HVMSR_PER_VCPU )
> + return -ENOENT;
> + v = d->vcpu[hvm_sr_handlers[typecode].kind == HVMSR_PER_VCPU ?
> + instance : 0];
I think this would be easier to read (less redundancy) as
if ( hvm_sr_handlers[typecode].kind != HVMSR_PER_VCPU )
v = d->vcpu[0];
else if ( instance >= d->max_vcpus || !d->vcpu[instance] )
return -ENOENT;
else
v = d->vcpu[instance];
When I had suggested putting the conditional operator inside the
square brackets there was too little context provided. Should I end
up committing this, I think I'll edit the patch accordingly (the NULL
check needs adding anyway).
With at least the NULL check in place
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |