Skip to content

Commit

Permalink
[media] v4l: vb2-dma-contig: align buffer size to PAGE_SIZE
Browse files Browse the repository at this point in the history
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: Tomasz Stanislawski <t.stanislaws@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Tomasz Stanislawski authored and Mauro Carvalho Chehab committed Nov 25, 2012
1 parent d81e870 commit a812a96
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/media/v4l2-core/videobuf2-dma-contig.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size)
if (!buf)
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);
if (!buf->vaddr) {
dev_err(dev, "dma_alloc_coherent of size %ld failed\n", size);
Expand Down

0 comments on commit a812a96

Please sign in to comment.