On Mon, Feb 25, 2019 at 6:36 AM Andrew F. Davis <a...@ti.com> wrote:
> +static int dma_heap_buffer_alloc(struct dma_heap *heap, size_t len, unsigned 
> int flags)
> +{
> +       struct dma_heap_buffer *buffer;
> +       int fd, ret;
> +
> +       buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
> +       if (!buffer)
> +               return -ENOMEM;
> +
> +       buffer->heap = heap;
> +       ret = heap->ops->allocate(heap, buffer, len, flags);
> +       if (ret) {
> +               kfree(buffer);
> +               return ret;
> +       }

Similarly, I think the struct dma_heap_buffer, should be allocated and
returned by the heap's allocate function.

That way it can allocate its own larger structure (with the
dma_heap_buffer as part of it) with private fields, and use
container_of() to traverse from the buffer to the private data.

Once I get things building, I'll share my changes.

thanks
-john
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to