Commit dabb01c2 authored by Nathan Chancellor's avatar Nathan Chancellor Committed by Greg Kroah-Hartman

staging: android: ion: Check return value of ion_buffer_kmap_get

GCC warns that vaddr is set but unused. Check the return value of
ion_buffer_kmap_get to make vaddr useful and make sure everything
is properly configured before beginning a DMA.
Suggested-by: default avatarLaura Abbott <labbott@redhat.com>
Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d1598d4e
...@@ -315,6 +315,7 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, ...@@ -315,6 +315,7 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
struct ion_buffer *buffer = dmabuf->priv; struct ion_buffer *buffer = dmabuf->priv;
void *vaddr; void *vaddr;
struct ion_dma_buf_attachment *a; struct ion_dma_buf_attachment *a;
int ret = 0;
/* /*
* TODO: Move this elsewhere because we don't always need a vaddr * TODO: Move this elsewhere because we don't always need a vaddr
...@@ -322,6 +323,10 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, ...@@ -322,6 +323,10 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
if (buffer->heap->ops->map_kernel) { if (buffer->heap->ops->map_kernel) {
mutex_lock(&buffer->lock); mutex_lock(&buffer->lock);
vaddr = ion_buffer_kmap_get(buffer); vaddr = ion_buffer_kmap_get(buffer);
if (IS_ERR(vaddr)) {
ret = PTR_ERR(vaddr);
goto unlock;
}
mutex_unlock(&buffer->lock); mutex_unlock(&buffer->lock);
} }
...@@ -330,9 +335,10 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, ...@@ -330,9 +335,10 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->nents, dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->nents,
direction); direction);
} }
mutex_unlock(&buffer->lock);
return 0; unlock:
mutex_unlock(&buffer->lock);
return ret;
} }
static int ion_dma_buf_end_cpu_access(struct dma_buf *dmabuf, static int ion_dma_buf_end_cpu_access(struct dma_buf *dmabuf,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment