[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 4/5] ALSA: xen-front: Implement handling of shared buffers
On 17/04/18 11:22, Oleksandr Andrushchenko wrote: > On 04/16/2018 04:39 PM, Juergen Gross wrote: >> On 16/04/18 08:24, Oleksandr Andrushchenko wrote: >>> +static int alloc_int_buffers(struct xen_snd_front_shbuf *buf, >>> + int num_pages_dir, int num_pages_buffer, >>> + int num_grefs) >>> +{ >>> + buf->grefs = kcalloc(num_grefs, sizeof(*buf->grefs), GFP_KERNEL); >>> + if (!buf->grefs) >>> + return -ENOMEM; >>> + >>> + buf->directory = kcalloc(num_pages_dir, XEN_PAGE_SIZE, GFP_KERNEL); >>> + if (!buf->directory) >>> + goto fail; >>> + >>> + buf->buffer_sz = num_pages_buffer * XEN_PAGE_SIZE; >>> + buf->buffer = alloc_pages_exact(buf->buffer_sz, GFP_KERNEL); >>> + if (!buf->buffer) >>> + goto fail; >>> + >>> + return 0; >>> + >>> +fail: >>> + kfree(buf->grefs); >>> + buf->grefs = NULL; >>> + kfree(buf->directory); >> Why do you need to free those here? Shouldn't that be done via >> xen_snd_front_shbuf_free() in case of an error? > At this place we only allocate memory, but xen_snd_front_shbuf_free > will also try to gnttab_end_foreign_access if buf->grefs != NULL. Okay. Juergen _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |