Re: [PATCH] staging: media: tegra-video: Use common error handling code in tegra_vi_graph_parse_one()

From: Dan Carpenter
Date: Sat Mar 02 2024 - 04:30:57 EST


On Fri, Mar 01, 2024 at 06:39:36PM +0100, Luca Ceresoli wrote:
> Hello Markus,
>
> On Thu, 29 Feb 2024 19:55:46 +0100
> Markus Elfring <Markus.Elfring@xxxxxx> wrote:
>
> > From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> > Date: Thu, 29 Feb 2024 19:44:36 +0100
> >
> > Add a jump target so that a bit of exception handling can be better reused
> > at the end of this function implementation.
> >
> > Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
>
> Reviewed-by: Luca Ceresoli <luca.ceresoli@xxxxxxxxxxx>

These patches make the code worse. If we're in the middle of a loop,
then we should clean up the partial loop before doing the goto.
Otherwise it creates a mess when we add a new allocation function after
the end of the loop.

Someone is going to add a _scoped() loop which uses cleanup.h magic to
call _put automatically. This is a good option.

regards,
dan carpenter