diff options
author | zhong jiang <zhongjiang@huawei.com> | 2018-08-18 18:16:55 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-09-12 17:48:59 +0300 |
commit | ee23c78c79b6599c9791d7615f0282aa1536b019 (patch) | |
tree | 94a9afcae46cada174ee170bf4c72839d443a99b /drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c | |
parent | eac7230fdb4672c2cb56f6a01a1744f562c01f80 (diff) | |
download | linux-ee23c78c79b6599c9791d7615f0282aa1536b019.tar.xz |
media: mtk_vcodec_util: Use dma_zalloc_coherent to replace dma_alloc_coherent + memset
dma_zalloc_coherent has implemented the dma_alloc_coherent() + memset(),
We prefer to dma_zalloc_coherent instead of open-codeing.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c')
-rw-r--r-- | drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c index 0c28d0b995cc..e80123cba406 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c @@ -49,16 +49,13 @@ int mtk_vcodec_mem_alloc(struct mtk_vcodec_ctx *data, struct mtk_vcodec_ctx *ctx = (struct mtk_vcodec_ctx *)data; struct device *dev = &ctx->dev->plat_dev->dev; - mem->va = dma_alloc_coherent(dev, size, &mem->dma_addr, GFP_KERNEL); - + mem->va = dma_zalloc_coherent(dev, size, &mem->dma_addr, GFP_KERNEL); if (!mem->va) { mtk_v4l2_err("%s dma_alloc size=%ld failed!", dev_name(dev), size); return -ENOMEM; } - memset(mem->va, 0, size); - mtk_v4l2_debug(3, "[%d] - va = %p", ctx->id, mem->va); mtk_v4l2_debug(3, "[%d] - dma = 0x%lx", ctx->id, (unsigned long)mem->dma_addr); |