On Fri, 3 Jul 2026 07:00:10 +0200 Markus Elfring <[email protected]> wrote:
> > No, it's fine as is. > Does this feedback mean that you disagree to an essential development > requirement > according to such a programming interface? > https://elixir.bootlin.com/linux/v7.1.2/source/include/linux/cleanup.h#L142-L153 > * Given that the "__free(...) = NULL" pattern for variables defined at > * the top of the function poses this potential interdependency problem > * the recommendation is to always define and assign variables in one > * statement and not group variable definitions at the top of the > * function when __free() is used. This is really just a guideline. > * > * Lastly, given that the benefit of cleanup helpers is removal of > * "goto", and that the "goto" statement can jump between scopes, the > * expectation is that usage of "goto" and cleanup helpers is never > * mixed in the same function. I.e. for a given routine, convert all > * resources that need a "goto" cleanup to scope-based cleanup, or > * convert none of them. The above has more to do with guard()s and not so much with a __free() at the top of the function. The reason is because things get broken if a goto jumps over a guard(). In other words, if you don't know what you are doing, don't mix them. -- Steve
