arm: dma-mapping: DMA buf may not have cpu virtual addr

DMA buffers may not have cpu virtual addresses when
allocated using DMA_ATTR_NO_KERNEL_MAPPING attribute.
Page address should therefore be looked up while
searching for such dma bufs.

Also fix the printk format specifier to '%pK' to print
kernel pointers.

Change-Id: I5754cde63ace19aed88624a36186d012309d475b
Signed-off-by: Shiraz Hashim <shashim@codeaurora.org>
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
Signed-off-by: Vijayanand Jitta <vjitta@codeaurora.org>
Signed-off-by: Qingqing Zhou <qqzhou@codeaurora.org>
This commit is contained in:
Shiraz Hashim 2018-03-19 20:02:23 +05:30 • committed by Gerrit - the friendly Code Review server
commit b7b349c452

View file

@ -858,9 +858,10 @@ static void __arm_dma_free(struct device *dev, size_t size, void *cpu_addr,
.page = page,
.want_vaddr = ((attrs & DMA_ATTR_NO_KERNEL_MAPPING) == 0),
};
void *addr = (args.want_vaddr) ? cpu_addr : page;
buf = arm_dma_buffer_find(cpu_addr);
if (WARN(!buf, "Freeing invalid buffer %p\n", cpu_addr))
buf = arm_dma_buffer_find(addr);
if (WARN(!buf, "Freeing invalid buffer %pK\n", addr))
return;
buf->allocator->free(&args);