Re: [PATCH v4 10/10] PM: EM: Use scope-based cleanup helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/09/2025 15:41, Rafael J. Wysocki wrote:
>>>  em_cpufreq_update_efficiencies(struct device *dev, struct em_perf_state *table)
>>>  {
>>>       struct em_perf_domain *pd = dev->em_pd;
>>> -     struct cpufreq_policy *policy;
>>> +     struct cpufreq_policy *policy __free(put_cpufreq_policy) = NULL;
>>
>> This is not really correct coding style. Please read how to use
>> cleanup.h expressed in that header. You should have here proper
>> constructor or this should be moved. Or this should not be __free()...
> 
> I gather that this is what you mean (quoted verbatim from cleanup.h)
> 
>  * 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.
> 
> and thanks for pointing this out!


... and the only exception would be if there is no single constructor,
but multiple (in if() block). That's not the case here, I think.

Best regards,
Krzysztof




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux