From: zhong jiang <zhongjiang@huawei.com>
To: <yong.zhi@intel.com>, <sakari.ailus@linux.intel.com>,
<bingbu.cao@intel.com>, <mchehab@kernel.org>,
<matthias.bgg@gmail.com>
Cc: <tian.shu.qiu@intel.com>, <jian.xu.zheng@intel.com>,
<linux-kernel@vger.kernel.org>, <linux-media@vger.kernel.org>
Subject: [PATCH 2/2] media: mtk_vcodec_util: Use dma_zalloc_coherent to replace dma_alloc_coherent + memset
Date: Sat, 18 Aug 2018 23:16:55 +0800 [thread overview]
Message-ID: <1534605415-11452-3-git-send-email-zhongjiang@huawei.com> (raw)
In-Reply-To: <1534605415-11452-1-git-send-email-zhongjiang@huawei.com>
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>
---
drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c | 5 +----
1 file changed, 1 insertion(+), 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 0c28d0b..e80123c 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);
--
1.7.12.4
next prev parent reply other threads:[~2018-08-18 15:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-18 15:16 [PATCH 0/2] media: Use dma_zalloc_coherent to replace dma_alloc_coherent + memset zhong jiang
2018-08-18 15:16 ` [PATCH 1/2] media: ipu3-cio2: " zhong jiang
2018-08-24 2:58 ` Bing Bu Cao
2018-08-24 3:36 ` zhong jiang
2018-08-18 15:16 ` zhong jiang [this message]
2018-08-23 11:23 ` [PATCH 0/2] media: " zhong jiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1534605415-11452-3-git-send-email-zhongjiang@huawei.com \
--to=zhongjiang@huawei.com \
--cc=bingbu.cao@intel.com \
--cc=jian.xu.zheng@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=tian.shu.qiu@intel.com \
--cc=yong.zhi@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).