vdin: add dolby mem release protection [1/1]

PD#SWPL-8797

Problem:
sometime oops occurred for vdin_dolby mem release

Solution:
add vdin dolby mem alloc flag & release protection

Verify:
x301

Change-Id: Iee90b58a0624c32032e204adcd043c8e94d03f1f
Signed-off-by: Evoke Zhang <evoke.zhang@amlogic.com>
This commit is contained in:
Evoke Zhang
2019-05-21 17:23:57 +08:00
committed by Jianxin Pan
parent 94b0dc8af4
commit 3e859c8b9a
2 changed files with 6 additions and 0 deletions

View File

@@ -3677,6 +3677,7 @@ void vdin_dolby_addr_alloc(struct vdin_dev_s *devp, unsigned int size)
devp->vfp->dv_buf_mem[index],
devp->vfp->dv_buf_vmem[index]);
}
devp->dv.dv_mem_alloced = 1;
pr_info("%s:dv_dma_vaddr=0x%p,dv_dma_paddr=0x%lx\n", __func__,
devp->dv.dv_dma_vaddr, (ulong)devp->dv.dv_dma_paddr);
}
@@ -3686,6 +3687,9 @@ void vdin_dolby_addr_release(struct vdin_dev_s *devp, unsigned int size)
int highmem_flag;
int index;
if (devp->dv.dv_mem_alloced == 0)
return;
alloc_size = dolby_size_byte*size;
if (devp->dv.dv_dma_vaddr)
dma_free_coherent(&devp->this_pdev->dev, alloc_size,
@@ -3706,6 +3710,7 @@ void vdin_dolby_addr_release(struct vdin_dev_s *devp, unsigned int size)
}
}
}
devp->dv.dv_mem_alloced = 0;
}
static void vdin_dolby_metadata_swap(struct vdin_dev_s *devp, char *buf)

View File

@@ -195,6 +195,7 @@ struct vdin_dv_s {
bool dv_flag;
bool dv_config;
bool dv_crc_check;/*0:fail;1:ok*/
unsigned int dv_mem_alloced;
};
struct vdin_afbce_s {