Re: [patch 13/13] ptp: Convert ptp_open/read() to __free()

From: Thomas Gleixner
Date: Wed Jun 25 2025 - 06:36:04 EST


On Tue, Jun 24 2025 at 09:36, Jakub Kicinski wrote:
> On Fri, 20 Jun 2025 15:24:50 +0200 (CEST) Thomas Gleixner wrote:
>> Get rid of the kfree() and goto maze and just return error codes directly.
>
> Maybe just skip this patch? FWIW we prefer not to use __free()
> within networking code. But this is as much time as networking
> so up to you.
>
> Using device-managed and cleanup.h constructs
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> [...]
>
> Low level cleanup constructs (such as ``__free()``) can be used when building
> APIs and helpers, especially scoped iterators. However, direct use of
> ``__free()`` within networking core and drivers is discouraged.
> Similar guidance applies to declaring variables mid-function.

Interesting decision, unfortunately it lacks a rationale in that
documentation.

I reworked the patch without the __free(), which still cleans up the mix
of goto exit and return ERRCODE inconsistencies.

Let me send out V3 with that and network/ptp people can still decided to
ignore it :)

Thanks,

tglx