Commit a812a966 authored by Tomasz Stanislawski's avatar Tomasz Stanislawski Committed by Mauro Carvalho Chehab

[media] v4l: vb2-dma-contig: align buffer size to PAGE_SIZE

Most operations on DMA and DMABUF framework require the size of a buffer to be
page aligned. This patch guarantees the requirement is satisfied for all
vb2-dma-contig buffers.
Signed-off-by: default avatarTomasz Stanislawski <t.stanislaws@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent d81e870d
...@@ -162,6 +162,9 @@ static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size) ...@@ -162,6 +162,9 @@ static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size)
if (!buf) if (!buf)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
/* align image size to PAGE_SIZE */
size = PAGE_ALIGN(size);
buf->vaddr = dma_alloc_coherent(dev, size, &buf->dma_addr, GFP_KERNEL); buf->vaddr = dma_alloc_coherent(dev, size, &buf->dma_addr, GFP_KERNEL);
if (!buf->vaddr) { if (!buf->vaddr) {
dev_err(dev, "dma_alloc_coherent of size %ld failed\n", size); dev_err(dev, "dma_alloc_coherent of size %ld failed\n", size);
......
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