Fri, Sep 27, 2024 at 01:20:57AM +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(). > > After switching to the scoped variant, there is no longer need for a > jump to 'err_child_out', as an immediate return is possible. ... > if (ret) { > dev_err(priv->dev, "LED without ID number"); > - goto err_child_out; > + return ret; Now return dev_err_probe(...); > } > > if (led->reg > U8_MAX) { > dev_err(priv->dev, "LED value %d is invalid", led->reg); > - ret = -EINVAL; > - goto err_child_out; > + return -EINVAL; Ditto. > } > dev_err(priv->dev, > "failed to register LED device %s, err %d", > led->ldev.name, ret); > - goto err_child_out; > + return ret; Ditto. return dev_err_probe(priv->dev, ret, "failed to register LED device %s\n", led->ldev.name); ... Also notice missed '\n' at the end of the strings (and yes, I know that it's not a problem for dev_*() macros, but still...). -- With Best Regards, Andy Shevchenko