>>> On 18.05.17 at 19:09, <wei.l...@citrix.com> wrote:
> --- a/xen/arch/x86/pv/traps.c
> +++ b/xen/arch/x86/pv/traps.c
> @@ -264,6 +264,24 @@ long unregister_guest_nmi_callback(void)
>      return 0;
>  }
>  
> +int guest_has_trap_callback(struct domain *d, uint16_t vcpuid,

bool and all pointers (including the local variables) can be const
afaict (albeit I question the value of both of the local variables,
as each is being used just once). And let's please avoid uint16_t
here when it doesn't really need to be other than unsigned int.

> +                            unsigned int trap_nr)
> +{
> +    struct vcpu *v;
> +    struct trap_info *t;
> +
> +    BUG_ON(d == NULL);
> +    BUG_ON(vcpuid >= d->max_vcpus);
> +
> +    /* Sanity check - XXX should be more fine grained. */
> +    BUG_ON(trap_nr >= NR_VECTORS);
> +
> +    v = d->vcpu[vcpuid];
> +    t = &v->arch.pv_vcpu.trap_ctxt[trap_nr];
> +
> +    return (t->address != 0);

With the return type being bool, the != 0 (and the already
pointless parentheses) could then be dropped too.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to