linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] media:rkvdec:Remove redundant memset
@ 2022-06-17  9:39 Zhang Zekun
  2022-06-20  7:59 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang Zekun @ 2022-06-17  9:39 UTC (permalink / raw)
  To: ezequiel, mchehab, gregkh
  Cc: linux-media, linux-rockchip, linux-staging, linux-kernel

As dma_alloc_coherent() will return a zeroed buffer, we
don't need to memset the returned buffer.
priv_tbl = dma_alloc_coherent() and count_tbl = dma_alloc_coherent()
should be enough.

-see commit 750afb08ca71 ("cross-tree: phase out dma_zalloc_coherent()")

Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
---
 drivers/staging/media/rkvdec/rkvdec-vp9.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/media/rkvdec/rkvdec-vp9.c b/drivers/staging/media/rkvdec/rkvdec-vp9.c
index 311a12656072..c2f42e76be10 100644
--- a/drivers/staging/media/rkvdec/rkvdec-vp9.c
+++ b/drivers/staging/media/rkvdec/rkvdec-vp9.c
@@ -1015,7 +1015,6 @@ static int rkvdec_vp9_start(struct rkvdec_ctx *ctx)
 
 	vp9_ctx->priv_tbl.size = sizeof(*priv_tbl);
 	vp9_ctx->priv_tbl.cpu = priv_tbl;
-	memset(priv_tbl, 0, sizeof(*priv_tbl));
 
 	count_tbl = dma_alloc_coherent(rkvdec->dev, RKVDEC_VP9_COUNT_SIZE,
 				       &vp9_ctx->count_tbl.dma, GFP_KERNEL);
@@ -1026,7 +1025,6 @@ static int rkvdec_vp9_start(struct rkvdec_ctx *ctx)
 
 	vp9_ctx->count_tbl.size = RKVDEC_VP9_COUNT_SIZE;
 	vp9_ctx->count_tbl.cpu = count_tbl;
-	memset(count_tbl, 0, sizeof(*count_tbl));
 	rkvdec_init_v4l2_vp9_count_tbl(ctx);
 
 	return 0;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] media:rkvdec:Remove redundant memset
  2022-06-17  9:39 [PATCH -next] media:rkvdec:Remove redundant memset Zhang Zekun
@ 2022-06-20  7:59 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2022-06-20  7:59 UTC (permalink / raw)
  To: Zhang Zekun
  Cc: ezequiel, mchehab, gregkh, linux-media, linux-rockchip,
	linux-staging, linux-kernel

On Fri, Jun 17, 2022 at 09:39:25AM +0000, Zhang Zekun wrote:
> As dma_alloc_coherent() will return a zeroed buffer, we
> don't need to memset the returned buffer.
> priv_tbl = dma_alloc_coherent() and count_tbl = dma_alloc_coherent()
> should be enough.
> 
> -see commit 750afb08ca71 ("cross-tree: phase out dma_zalloc_coherent()")
> 
> Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
> ---

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-20  8:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-17  9:39 [PATCH -next] media:rkvdec:Remove redundant memset Zhang Zekun
2022-06-20  7:59 ` Dan Carpenter

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).