[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.2019 17:39, Jan Beulich wrote: >>>> 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. This was done after a discussion with George https://lists.xenproject.org/archives/html/xen-devel/2019-01/msg00740.html I will update the patch comment with this 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)? I will move the rc = 0 there in v2. Thanks, Alex _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |