Re: [PATCH v3 12/12] PM: EM: Use scope-based cleanup helper

From: Krzysztof Kozlowski
Date: Wed Sep 03 2025 - 02:11:38 EST


On 03/09/2025 04:12, Zihuan Zhang wrote:
>> You are not improving the source code here. This is not how to use
>> __free() and you clearly do not understand the source code.
>
> Sorry for the problem, policy should be assigned after cpumask_test_cpu().
>
> I actually realized earlier that __free() only frees at the end of the variable’s lifetime.
> I had suggested using a braced macro in cpufreq.h to allow immediate release after use,
> but I understand the maintainer’s advice to “keep it simple” and will follow that.
>
>> What's more, you did not use standard tools which would tell you this is
>> buggy and wrong.
>
> Could you please let me know which standard tools you recommend for detecting such issues?
>
> I’d like to use them to avoid similar mistakes in the future.
All standard tools used for kernel development, sparse, smatch, clang,
coccinelle, see my talk from OSSE25.

Best regards,
Krzysztof