From c48541cee103d0a1e5fbafa2993b73cd54cdca2f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 15 Dec 2020 12:37:06 +0100 Subject: [PATCH] ANDROID: fix up merge issues with dma buffer changes in cma_heap.c Because of 20e76f1a7059 ("dma-buf: Use struct dma_buf_map in dma_buf_vunmap() interfaces") and 6619ccf1bb1d ("dma-buf: Use struct dma_buf_map in dma_buf_vmap() interfaces"), the vmap and vunmap callback functions changed. Fix up the cma_heap.c code to reflect these changes. Fixes: b61614ec318a ("dma-buf: heaps: Add CMA heap to dmabuf heaps") Signed-off-by: Greg Kroah-Hartman Change-Id: I14e8d404a945db3b63f78a811f23928ecb316c2c --- drivers/dma-buf/heaps/cma_heap.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/dma-buf/heaps/cma_heap.c b/drivers/dma-buf/heaps/cma_heap.c index 4772c8729e77..00921db42bf7 100644 --- a/drivers/dma-buf/heaps/cma_heap.c +++ b/drivers/dma-buf/heaps/cma_heap.c @@ -199,7 +199,7 @@ static void *cma_heap_do_vmap(struct cma_heap_buffer *buffer) return vaddr; } -static void *cma_heap_vmap(struct dma_buf *dmabuf) +static int cma_heap_vmap(struct dma_buf *dmabuf, struct dma_buf_map *map) { struct cma_heap_buffer *buffer = dmabuf->priv; void *vaddr; @@ -212,18 +212,21 @@ static void *cma_heap_vmap(struct dma_buf *dmabuf) } vaddr = cma_heap_do_vmap(buffer); - if (IS_ERR(vaddr)) - goto out; + if (IS_ERR(vaddr)) { + mutex_unlock(&buffer->lock); + return PTR_ERR(vaddr); + } buffer->vaddr = vaddr; buffer->vmap_cnt++; out: mutex_unlock(&buffer->lock); - return vaddr; + dma_buf_map_set_vaddr(map, vaddr); + return 0; } -static void cma_heap_vunmap(struct dma_buf *dmabuf, void *vaddr) +static void cma_heap_vunmap(struct dma_buf *dmabuf, struct dma_buf_map *map) { struct cma_heap_buffer *buffer = dmabuf->priv;