Re: [PATCH] net: fman: Use common error handling code in dtsec_init()

From: Dan Carpenter
Date: Wed Feb 28 2024 - 10:00:03 EST


On Wed, Feb 28, 2024 at 08:51:49AM +0100, Jiri Pirko wrote:
> Wed, Feb 28, 2024 at 03:46:57AM CET, kuba@xxxxxxxxxx wrote:
> >On Tue, 27 Feb 2024 14:14:52 +0100 Markus Elfring wrote:
> >> Adjust jump targets so that a bit of exception handling can be better
> >> reused at the end of this function implementation.
> >
> >Okay, but..
> >
> >> .../net/ethernet/freescale/fman/fman_dtsec.c | 19 +++++++++++--------
> >> 1 file changed, 11 insertions(+), 8 deletions(-)
> >
> >..you've added more lines than you've removed so what's the point.
>
> To have cleaner error path? Not always lines of code is the correct
> indicator of patch quality :)
>

I really don't like those goto e_nomem type of things. When you're
laddering gotos you should do that kind of thing before the gotos so
that when people add new gotos it doesn't make a mess. It's the same
for unlocks, do that before the goto unless it matches a lock at the
very start of the function. Or if you're doing a goto from inside a
loop then clean up the partial iteration through the loop before the
goto.

regards,
dan carpenter