public inbox for linux-rockchip@lists.infradead.org
 help / color / mirror / Atom feed
From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
To: Detlev Casanova <detlev.casanova@collabora.com>,
	 linux-kernel@vger.kernel.org
Cc: Benjamin Gaignard <benjamin.gaignard@collabora.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	 linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
	 kernel@collabora.com
Subject: Re: [PATCH] media: verisilicon: Free post processor buffers on error
Date: Mon, 28 Apr 2025 13:25:59 -0400	[thread overview]
Message-ID: <d901822b2710a2d642f1372fbfb53f99f1e60b2e.camel@collabora.com> (raw)
In-Reply-To: <20250425192447.227063-1-detlev.casanova@collabora.com>

Le vendredi 25 avril 2025 à 15:24 -0400, Detlev Casanova a écrit :
> When initializing the post processor, it allocates the same number of

What do you think reworking as:

  During initialization, the post processor allocates the same number of

> buffers as the buf queue.
> As the init function is called in streamon(), if an allocation fails,
> streamon will return an error and streamoff() will not be called, keeping
> all post processor buffers allocated.
> 
> To avoid that, all post proc buffers are freed in case of an allocation
> error.
> 
> Fixes: 26711491a807 ("media: verisilicon: Refactor postprocessor to store more buffers")
> Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

If you are fine with the suggestion, I can make the changes while
applying.

> ---
>  drivers/media/platform/verisilicon/hantro_postproc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/verisilicon/hantro_postproc.c b/drivers/media/platform/verisilicon/hantro_postproc.c
> index c435a393e0cb7..9f559a13d409b 100644
> --- a/drivers/media/platform/verisilicon/hantro_postproc.c
> +++ b/drivers/media/platform/verisilicon/hantro_postproc.c
> @@ -250,8 +250,10 @@ int hantro_postproc_init(struct hantro_ctx *ctx)
>  
>  	for (i = 0; i < num_buffers; i++) {
>  		ret = hantro_postproc_alloc(ctx, i);
> -		if (ret)
> +		if (ret) {
> +			hantro_postproc_free(ctx);
>  			return ret;
> +		}
>  	}
>  
>  	return 0;

-- 
Nicolas Dufresne
Principal Engineer at Collabora

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  reply	other threads:[~2025-04-28 17:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-25 19:24 [PATCH] media: verisilicon: Free post processor buffers on error Detlev Casanova
2025-04-28 17:25 ` Nicolas Dufresne [this message]
2025-04-29 12:51   ` Detlev Casanova

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=d901822b2710a2d642f1372fbfb53f99f1e60b2e.camel@collabora.com \
    --to=nicolas.dufresne@collabora.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=detlev.casanova@collabora.com \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --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