Netdev List
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: manushprajwal <manushprajwal555@gmail.com>
Cc: davem@davemloft.net, Andrew Lunn <andrew+netdev@lunn.ch>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH v2] net: ethernet: ti: netcp_core: fix device_node refcount leak in netcp_probe()
Date: Fri, 14 Aug 2026 22:06:32 +0200	[thread overview]
Message-ID: <948c88a2-d8ef-420e-a862-10487d9f0d50@lunn.ch> (raw)
In-Reply-To: <20260814190453.951-1-manushprajwal555@gmail.com>

On Sat, Aug 15, 2026 at 12:34:53AM +0530, manushprajwal wrote:
> From: Manush Prajwal <manushprajwal555@gmail.com>
> 
> When netcp_create_interface() failed for a given child node,
> netcp_probe() jumped to probe_quit_interface, which released the
> "interfaces" parent node but never the "child" node that the
> for_each_available_child_of_node() loop was iterating on.
> 
> Rework the loop around for_each_available_child_of_node_scoped()
> instead of adding a manual of_node_put(). child is only read inside
> the loop body and is never used after it, so the scoped macro's
> automatic cleanup on the goto is sufficient on its own.
> 
> Signed-off-by: Manush Prajwal <manushprajwal555@gmail.com>
> ---
> v2: Rework using for_each_available_child_of_node_scoped() instead of
>     a manual of_node_put(), per Andrew Lunn's review.
> 
>  drivers/net/ethernet/ti/netcp_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
> index eb8fc2ed05..a888aa35fa 100644
> --- a/drivers/net/ethernet/ti/netcp_core.c
> +++ b/drivers/net/ethernet/ti/netcp_core.c
> @@ -2204,7 +2204,7 @@ static int netcp_probe(struct platform_device *pdev)
>  {
>  	struct device_node *node = pdev->dev.of_node;
>  	struct netcp_intf *netcp_intf, *netcp_tmp;
> -	struct device_node *child, *interfaces;
> +	struct device_node *interfaces;
>  	struct netcp_device *netcp_device;

Reverse Christmas Tree

Please also read:

https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html

    Andrew

---
pw-bot: cr

      reply	other threads:[~2026-08-14 20:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 19:04 [PATCH v2] net: ethernet: ti: netcp_core: fix device_node refcount leak in netcp_probe() manushprajwal
2026-08-14 20:06 ` Andrew Lunn [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=948c88a2-d8ef-420e-a862-10487d9f0d50@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=manushprajwal555@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox