Subject: Re: [PATCH net v1 1/1] net dsa: qca8k: fix usages of device_get_named_child_node()

From: Jakub Kicinski <[email-masked]>
Date: Wed, 5 Jun 2024 20:00:02 -0700

On Tue,  4 Jun 2024 19:15:51 +0300 Andy Shevchenko wrote:
> @@ -431,8 +431,10 @@ qca8k_parse_port_leds(struct qca8k_priv *priv, struct fwnode_handle *port, int p
>  		init_data.devicename = kasprintf(GFP_KERNEL, "%s:0%d",
>  						 priv->internal_mdio_bus->id,
>  						 port_num);
> -		if (!init_data.devicename)
> +		if (!init_data.devicename) {
> +			fwnode_handle_put(leds);
>  			return -ENOMEM;
> +		}
>  
>  		ret = devm_led_classdev_register_ext(priv->dev, &port_led->cdev, &init_data);
>  		if (ret)

I think there's more bugs in this here loop, if we break or return
during fwnode_for_each_child_node() - we need to put the iterator (led).