[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v1] x86/mm: Clean up p2m_finish_type_change return value



>>> On 16.01.19 at 16:13, <aisaila@xxxxxxxxxxxxxxx> wrote:
> Changed the return value of 1 to 0 so now p2m_finish_type_change returns
> 0 for success or <0 for error.

This is a valid alternative return value model. Both have their merits.
Hence if you want to change from one to the other, you should give
a reason.

> --- a/xen/arch/x86/mm/p2m.c
> +++ b/xen/arch/x86/mm/p2m.c
> @@ -1178,6 +1178,7 @@ int p2m_finish_type_change(struct domain *d,
>  
>      if ( rc < 0 )
>          goto out;
> +    rc = 0;

Instead of this and ...

> @@ -1188,19 +1189,14 @@ int p2m_finish_type_change(struct domain *d,
>              if ( d->arch.altp2m_eptp[i] != mfn_x(INVALID_MFN) )
>              {
>                  struct p2m_domain *altp2m = d->arch.altp2m_p2m[i];
> -                int rc1;
>  
>                  p2m_lock(altp2m);
> -                rc1 = finish_type_change(altp2m, first_gfn, max_nr);
> +                rc = finish_type_change(altp2m, first_gfn, max_nr);
>                  p2m_unlock(altp2m);
>  
> -                if ( rc1 < 0 )
> -                {
> -                    rc = rc1;
> +                if ( rc < 0 )
>                      goto out;
> -                }
> -
> -                rc |= rc1;
> +                rc = 0;

... this, why don't you simply set "rc" to zero once ...

>              }
>      }
>  #endif

... below here (but ahead of the "out" label)?

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.