All of lore.kernel.org
 help / color / mirror / Atom feed
From: Detlev Casanova <detlev.casanova@collabora.com>
To: linux-kernel@vger.kernel.org,
	Nicolas Dufresne <nicolas.dufresne@collabora.com>
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: Tue, 29 Apr 2025 08:51:32 -0400	[thread overview]
Message-ID: <2782084.mvXUDI8C0e@earth> (raw)
In-Reply-To: <d901822b2710a2d642f1372fbfb53f99f1e60b2e.camel@collabora.com>

On Monday, 28 April 2025 13:25:59 EDT Nicolas Dufresne wrote:
> 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.

Yes, that's goot for me.

Detlev.

> > ---
> >  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;





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

WARNING: multiple messages have this Message-ID (diff)
From: Detlev Casanova <detlev.casanova@collabora.com>
To: linux-kernel@vger.kernel.org,
	Nicolas Dufresne <nicolas.dufresne@collabora.com>
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: Tue, 29 Apr 2025 08:51:32 -0400	[thread overview]
Message-ID: <2782084.mvXUDI8C0e@earth> (raw)
In-Reply-To: <d901822b2710a2d642f1372fbfb53f99f1e60b2e.camel@collabora.com>

On Monday, 28 April 2025 13:25:59 EDT Nicolas Dufresne wrote:
> 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.

Yes, that's goot for me.

Detlev.

> > ---
> >  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;





  reply	other threads:[~2025-04-29 12:51 UTC|newest]

Thread overview: 6+ 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-25 19:24 ` Detlev Casanova
2025-04-28 17:25 ` Nicolas Dufresne
2025-04-28 17:25   ` Nicolas Dufresne
2025-04-29 12:51   ` Detlev Casanova [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=2782084.mvXUDI8C0e@earth \
    --to=detlev.casanova@collabora.com \
    --cc=benjamin.gaignard@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=nicolas.dufresne@collabora.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.