]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
media: mtk_vcodec_util: Use dma_zalloc_coherent to replace dma_alloc_coherent + memset
authorzhong jiang <zhongjiang@huawei.com>
Sat, 18 Aug 2018 15:16:55 +0000 (11:16 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Wed, 12 Sep 2018 14:48:59 +0000 (10:48 -0400)
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>
drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c

index 0c28d0b995ccd7ff9a9679a3bd2726711fc6653c..e80123cba4062119b7c7aa2d0b99d470baacd39c 100644 (file)
@@ -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);