[PATCH v4 07/10] powercap: dtpm_cpu: Use scope-based cleanup helper

Krzysztof Kozlowski krzk at kernel.org
Thu Sep 4 20:55:23 AEST 2025


On 04/09/2025 12:37, Zihuan Zhang wrote:
>>   * 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.
> 
> 
> Should I replace all the memory allocation cleanups here with `__free`?
> That would allow us to drop all the `goto`s, but since this function has
> quite a few of them, I’m concerned it might introduce new issues. What’s
> your recommendation?

If you keep asking this, I have doubts you really know how to use
cleanup.h. Don't blindly convert code to cleanup.h. It's very odd syntax
and it is not even welcomed everywhere.

Best regards,
Krzysztof


More information about the Linuxppc-dev mailing list