Re: [PATCH net-next 3/3] net: dsa: mv88e6xxx: leds: fix leds refcount

From: Andy Shevchenko
Date: Thu Oct 10 2024 - 10:48:36 EST


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?

--
With Best Regards,
Andy Shevchenko