[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v3 16/38] arm/p2m: Add HVMOP_altp2m_set_domain_state
Hi Julien, On 09/09/2016 07:14 PM, Julien Grall wrote: > Hello Sergej, > > On 16/08/16 23:16, Sergej Proskurin wrote: >> +static int altp2m_init_helper(struct domain *d, unsigned int idx) >> +{ >> + int rc; >> + struct p2m_domain *p2m = d->arch.altp2m_p2m[idx]; >> + >> + ASSERT(p2m == NULL); >> + >> + /* Allocate a new, zeroed altp2m view. */ >> + p2m = xzalloc(struct p2m_domain); >> + if ( p2m == NULL) >> + { >> + rc = -ENOMEM; >> + goto err; >> + } > > This could be simplified with just return -ENOMEM. > True. I will do that. >> + >> + p2m->p2m_class = p2m_alternate; >> + >> + /* Initialize the new altp2m view. */ >> + rc = p2m_init_one(d, p2m); >> + if ( rc ) >> + goto err; >> + >> + p2m->access_required = false; >> + _atomic_set(&p2m->active_vcpus, 0); > > the p2m is initialized to 0, so both access_required and active_vcpus > initialization is not necessary. > I will remove these initializations in the next patch. >> + >> + d->arch.altp2m_p2m[idx] = p2m; >> + >> + return rc; >> + >> +err: >> + if ( p2m ) >> + xfree(p2m); > > xfree is able to handle NULL pointer. > Ok, thank you. >> + >> + d->arch.altp2m_p2m[idx] = NULL; >> + >> + return rc; >> +} >> + >> +int altp2m_init_by_id(struct domain *d, unsigned int idx) >> +{ >> + int rc = -EINVAL; >> + >> + if ( idx >= MAX_ALTP2M ) >> + return rc; >> + >> + altp2m_lock(d); >> + >> + if ( d->arch.altp2m_p2m[idx] == NULL ) >> + rc = altp2m_init_helper(d, idx); >> + >> + altp2m_unlock(d); >> + >> + return rc; >> +} >> + Cheers, ~Sergej _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |