Re: [PATCH net-next 3/3] net: dsa: mv88e6xxx: leds: fix leds refcount
From: Javier Carrasco
Date: Thu Oct 10 2024 - 15:16:08 EST
On 10/10/2024 16:33, Andy Shevchenko wrote:
> On Tue, Oct 08, 2024 at 06:10:29PM +0200, Javier Carrasco wrote:
>> The 'leds' fwnode_handle is initialized by calling
>> fwnode_get_named_child_node(), which requires an explicit call to
>> fwnode_handle_put() when the node is not required anymore.
>>
>> Instead of adding the missing call, and considering that this driver was
>> recently introduced, use the automatic clenaup mechanism to release the
>> node when it goes out of scope.
>
> ...
>
>> - leds = fwnode_get_named_child_node(p->fwnode, "leds");
>> + struct fwnode_handle *leds __free(fwnode_handle) =
>> + fwnode_get_named_child_node(p->fwnode, "leds");
>
> Can it be const?
>
Hi Andy,
in its current form, it could be const as its only assignment occurs in
its declaration. But if the final decision is moving it to the top and
giving it an initial NULL value, then that will not be possible for
obvious reasons.
I am fine with any of those options for v2.
Best regards,
Javier Carrasco