public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
To: Luo Qiu <luoqiu@kylinsec.com.cn>,
	Benjamin Gaignard	 <benjamin.gaignard@collabora.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	 Mauro Carvalho Chehab	 <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: verisilicon: Remove unnecessary memset() after dma_alloc_coherent
Date: Wed, 25 Mar 2026 09:21:57 -0400	[thread overview]
Message-ID: <c90e82bc630b54419d10ee6f179bc1239060a808.camel@collabora.com> (raw)
In-Reply-To: <856D681C2A51EC65+20260325050055.1187863-1-luoqiu@kylinsec.com.cn>

[-- 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 --]

      reply	other threads:[~2026-03-25 13:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=c90e82bc630b54419d10ee6f179bc1239060a808.camel@collabora.com \
    --to=nicolas.dufresne@collabora.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=luoqiu@kylinsec.com.cn \
    --cc=mchehab@kernel.org \
    --cc=p.zabel@pengutronix.de \
    /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