Re: [RFC PATCH 2/6] of: reserved-memory: Add of_reserved_mem_lookup_by_name

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

 



On 30/07/2025 12:57, Viresh Kumar wrote:
> On 30-07-25, 11:46, Krzysztof Kozlowski wrote:
>> On 30/07/2025 11:29, Viresh Kumar wrote:
>>> +	struct device_node *child __free(device_node) = NULL;
>>
>> This should not be NULL or this should not be cleanup. Follow coding
>> style for cleanup - constructor must be real here.
> 
> I may have misunderstood how cleanup works, but this is what I
> thought:
> 
> The cleanup is defined in of.h as:
> 
> DEFINE_FREE(device_node, struct device_node *, if (_T) of_node_put(_T))
> 
> 
> Doesn't this mean that it handles the case where `child` is NULL, by
> not calling of_node_put() ? So it should either be a valid constructor
> or NULL and not some stale value.

I am speaking about coding style. It's explicitly requested to use only
the full constructor syntax (see long time Linus' remark or just read
cleanup.h docs).

NULL is allowed in certain cases, but the code here does not look like
needing it in the first place.


Best regards,
Krzysztof




[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux