buf->vaddr = NULL;
clear_dma_buffer((struct aml_dma_buffer *)buf->priv, buf->index);
put_device(buf->dev);
- kfree(buf);
ge2d_log_dbg("ge2d free:aml_dma_buf=0x%p,buf->index=%d\n",
buf, buf->index);
+ kfree(buf);
}
static void *aml_dma_alloc(struct device *dev, unsigned long attrs,
if (cma_pages) {
paddr = page_to_phys(cma_pages);
} else {
+ kfree(buf);
pr_err("failed to alloc cma pages.\n");
return NULL;
}
{
struct aml_dma_buf *buf = buf_priv;
unsigned long pfn = 0;
- unsigned long vsize = vma->vm_end - vma->vm_start;
+ unsigned long vsize;
int ret = -1;
if (!buf || !vma) {
return -EINVAL;
}
+ vsize = vma->vm_end - vma->vm_start;
+
pfn = buf->dma_addr >> PAGE_SHIFT;
ret = remap_pfn_range(vma, vma->vm_start, pfn,
vsize, vma->vm_page_prot);
for_each_sg(sgt->sgl, sg, sgt->nents, i) {
struct page *page = phys_to_page(phys);
- if (!page) {
- sg_free_table(sgt);
- kfree(attach);
- return -ENOMEM;
- }
sg_set_page(sg, page, PAGE_SIZE, 0);
phys += PAGE_SIZE;
}
update_canvas_cfg(canvas_cfg,
cfg->dst_planes[i].addr,
cfg->dst_planes[i].w *
- src->bpp / 8,
+ dst->bpp / 8,
cfg->dst_planes[i].h);
}
}
u32 cs_width = 0, cs_height = 0, cs_addr = 0;
unsigned int data32;
unsigned int bpp;
- unsigned int block_mode[] = {2, 4, 8, 16, 16, 32, 0, 24};
+ unsigned int block_mode[] = {2, 4, 8, 16, 16, 32, 0, 24,
+ 0, 0, 0, 0, 0, 0, 0, 0};
src_dst->canvas_index = index;
if (ge2d_meson_dev.canvas_status == 0) {