Re: [PATCH net-next v6 3/6] net: bcmasp: Add support for ASP2.0 Ethernet controller

From: Jakub Kicinski
Date: Sat Jun 03 2023 - 02:54:04 EST


On Thu, 1 Jun 2023 15:12:28 -0700 Justin Chen wrote:
> + ports_node = of_find_node_by_name(dev->of_node, "ethernet-ports");
> + if (!ports_node) {
> + dev_warn(dev, "No ports found\n");
> + return 0;
> + }
> +
> + for_each_available_child_of_node(ports_node, intf_node) {
> + of_property_read_u32(intf_node, "reg", &port);
> + if (!bcmasp_is_port_valid(priv, port)) {
> + dev_warn(dev, "%pOF: %d is an invalid port\n",
> + intf_node, port);
> + continue;
> + }
> +
> + priv->intf_count++;
> + }

I think that you're leaking ports_node,

/**
* of_find_node_by_name - Find a node by its "name" property
* @from: The node to start searching from or NULL; the node
* you pass will not be searched, only the next one
* will. Typically, you pass what the previous call
* returned. of_node_put() will be called on @from.
* @name: The name string to match against
*
* Return: A node pointer with refcount incremented, use
* of_node_put() on it when done.
*/

--
pw-bot: cr