* [PATCH] media: verisilicon: Remove unnecessary memset() after dma_alloc_coherent
@ 2026-03-25 5:00 Luo Qiu
2026-03-25 13:21 ` Nicolas Dufresne
0 siblings, 1 reply; 2+ messages in thread
From: Luo Qiu @ 2026-03-25 5:00 UTC (permalink / raw)
To: Nicolas Dufresne, Benjamin Gaignard, Philipp Zabel,
Mauro Carvalho Chehab
Cc: linux-media, linux-rockchip, linux-kernel
dma_alloc_coherent() already returns zeroed memory, so the subsequent
memset(0) calls are redundant.
Signed-off-by: Luo Qiu <luoqiu@kylinsec.com.cn>
---
drivers/media/platform/verisilicon/hantro_vp9.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro_vp9.c b/drivers/media/platform/verisilicon/hantro_vp9.c
index 566cd376c097..607d618e8f4a 100644
--- a/drivers/media/platform/verisilicon/hantro_vp9.c
+++ b/drivers/media/platform/verisilicon/hantro_vp9.c
@@ -187,7 +187,6 @@ int hantro_vp9_dec_init(struct hantro_ctx *ctx)
return -ENOMEM;
tile_edge->size = size;
- memset(tile_edge->cpu, 0, size);
size = hantro_vp9_segment_map_size(max_width, max_height);
vp9_dec->segment_map_size = size;
@@ -198,7 +197,6 @@ int hantro_vp9_dec_init(struct hantro_ctx *ctx)
goto err_segment_map;
segment_map->size = size;
- memset(segment_map->cpu, 0, size);
size = hantro_vp9_prob_tab_size();
vp9_dec->ctx_counters_offset = size;
@@ -211,7 +209,6 @@ int hantro_vp9_dec_init(struct hantro_ctx *ctx)
goto err_misc;
misc->size = size;
- memset(misc->cpu, 0, size);
init_v4l2_vp9_count_tbl(ctx);
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] media: verisilicon: Remove unnecessary memset() after dma_alloc_coherent
2026-03-25 5:00 [PATCH] media: verisilicon: Remove unnecessary memset() after dma_alloc_coherent Luo Qiu
@ 2026-03-25 13:21 ` Nicolas Dufresne
0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Dufresne @ 2026-03-25 13:21 UTC (permalink / raw)
To: Luo Qiu, Benjamin Gaignard, Philipp Zabel, Mauro Carvalho Chehab
Cc: linux-media, linux-rockchip, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1501 bytes --]
Le mercredi 25 mars 2026 à 13:00 +0800, Luo Qiu a écrit :
> dma_alloc_coherent() already returns zeroed memory, so the subsequent
> memset(0) calls are redundant.
I don't think this statement is actually true, or at least not for all
architectures, and not without an explicit GFP_ZERO flag.
Nicolas
>
> Signed-off-by: Luo Qiu <luoqiu@kylinsec.com.cn>
> ---
> drivers/media/platform/verisilicon/hantro_vp9.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/media/platform/verisilicon/hantro_vp9.c b/drivers/media/platform/verisilicon/hantro_vp9.c
> index 566cd376c097..607d618e8f4a 100644
> --- a/drivers/media/platform/verisilicon/hantro_vp9.c
> +++ b/drivers/media/platform/verisilicon/hantro_vp9.c
> @@ -187,7 +187,6 @@ int hantro_vp9_dec_init(struct hantro_ctx *ctx)
> return -ENOMEM;
>
> tile_edge->size = size;
> - memset(tile_edge->cpu, 0, size);
>
> size = hantro_vp9_segment_map_size(max_width, max_height);
> vp9_dec->segment_map_size = size;
> @@ -198,7 +197,6 @@ int hantro_vp9_dec_init(struct hantro_ctx *ctx)
> goto err_segment_map;
>
> segment_map->size = size;
> - memset(segment_map->cpu, 0, size);
>
> size = hantro_vp9_prob_tab_size();
> vp9_dec->ctx_counters_offset = size;
> @@ -211,7 +209,6 @@ int hantro_vp9_dec_init(struct hantro_ctx *ctx)
> goto err_misc;
>
> misc->size = size;
> - memset(misc->cpu, 0, size);
>
> init_v4l2_vp9_count_tbl(ctx);
>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-25 13:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25 5:00 [PATCH] media: verisilicon: Remove unnecessary memset() after dma_alloc_coherent Luo Qiu
2026-03-25 13:21 ` Nicolas Dufresne
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox