Re: [PATCH net-next 2/3] net: dsa: mv88e6xxx: leds: fix led refcount in error path
From: Andy Shevchenko
Date: Thu Oct 10 2024 - 10:40:44 EST
On Tue, Oct 08, 2024 at 06:10:28PM +0200, Javier Carrasco wrote:
> The 'led' fwnode_handle within fwnode_for_each_child_node() must be
> released upon early exits by means of an explicit call to
> fwnode_handle_put(), which in this case is missing.
>
> Instead of adding the missing call, and considering that this driver was
> recently introduced, use a scoped variant of the loop to automatically
> decrement the child's refcount when it goes out of scope.
>
> Note that the _avaialable_ version of the loop has been used, as there
> is no apparent reason to walk over unavailable nodes.
...
> - struct fwnode_handle *led = NULL, *leds = NULL;
> + struct fwnode_handle *leds = NULL;
Can it be const now?
--
With Best Regards,
Andy Shevchenko