Re: [PATCH 05/18] leds: cr0014114: switch to device_for_each_child_node_scoped()

From: Andy Shevchenko
Date: Sat Nov 23 2024 - 14:31:24 EST


Fri, Sep 27, 2024 at 01:20:56AM +0200, Javier Carrasco kirjoitti:
> Switch to device_for_each_child_node_scoped() to simplify the code by
> removing the need for calls to fwnode_handle_put() in the error paths.
>
> This also prevents possible memory leaks if new error paths are added
> without the required call to fwnode_handle_put().

...

> if (ret) {
> dev_err(priv->dev,
> "failed to register LED device, err %d", ret);
> - fwnode_handle_put(child);
> return ret;

Now it can be
return dev_err_probe(..., ret, "failed to register LED device");

> }

--
With Best Regards,
Andy Shevchenko