Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4099040e authored by Lad, Prabhakar's avatar Lad, Prabhakar Committed by Mauro Carvalho Chehab
Browse files

[media] videobuf-dma-contig: restore buffer mapping for uncached bufers



from commit a8f3c203
restore the mapping scheme for uncached buffers,
which was changed in a common scheme for cached and uncached.
This apparently was wrong, and was probably intended only for cached buffers.
the fix fixes the crash observed while mapping uncached buffers.

Signed-off-by: default avatarLad, Prabhakar <prabhakar.lad@ti.com>
Signed-off-by: default avatarHadli, Manjunath <manjunath.hadli@ti.com>
Acked-by: default avatarFederico Vaga <federico.vaga@gmail.com>
Acked-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Cc: stable@kernel.org
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 4faba767
Loading
Loading
Loading
Loading
+32 −21
Original line number Diff line number Diff line
@@ -359,9 +359,19 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
	size = vma->vm_end - vma->vm_start;
	size = (size < mem->size) ? size : mem->size;

	if (!mem->cached)
	if (!mem->cached) {
		vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);

		retval = remap_pfn_range(vma, vma->vm_start,
			 mem->dma_handle >> PAGE_SHIFT,
				 size, vma->vm_page_prot);
		if (retval) {
			dev_err(q->dev, "mmap: remap failed with error %d. ",
								retval);
			dma_free_coherent(q->dev, mem->size,
					mem->vaddr, mem->dma_handle);
			goto error;
		}
	} else {
		pos = (unsigned long)mem->vaddr;

		while (size > 0) {
@@ -386,6 +396,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
			else
				size = 0;
		}
	}

	vma->vm_ops = &videobuf_vm_ops;
	vma->vm_flags |= VM_DONTEXPAND;