From: "Manush Prajwal" <manushprajwal555@gmail.com>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org
Cc: netdev@vger.kernel.org, andrew@lunn.ch
Subject: [PATCH v2] net: ethernet: ti: netcp_core: use for_each_available_child_of_node_scoped() in netcp_probe()
Date: 28 Aug 2026 14:26:27 +0530 [thread overview]
Message-ID: <6a914d3c.018c0331.f1305.be74@mx.google.com> (raw)
Rework the interfaces loop in netcp_probe() around
for_each_available_child_of_node_scoped() instead of adding a manual
of_node_put(child) at the probe_quit_interface error label, so the
reference on the current child node is released automatically on
every exit path from the loop, including the early goto on a
netcp_create_interface() failure. child is never used outside the
loop, so the now-unused outer child declaration is dropped along
with it; no extra of_node_get() is needed.
Suggested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Manush Prajwal <manushprajwal555@gmail.com>
---
v2: Rework around for_each_available_child_of_node_scoped() instead
of the manual of_node_put(child) from v1, 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 eb8fc2e..fbc011f 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;
struct device *dev = &pdev->dev;
struct netcp_module *module;
@@ -2246,7 +2246,7 @@ static int netcp_probe(struct platform_device *pdev)
goto probe_quit;
}
- for_each_available_child_of_node(interfaces, child) {
+ for_each_available_child_of_node_scoped(interfaces, child) {
ret = netcp_create_interface(netcp_device, child);
if (ret) {
dev_err(dev, "could not create interface(%pOFn)\n",
--
2.46.2.windows.1
next reply other threads:[~2026-08-28 8:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 8:56 Manush Prajwal [this message]
2026-08-28 13:10 ` [PATCH v2] net: ethernet: ti: netcp_core: use for_each_available_child_of_node_scoped() in netcp_probe() Andrew Lunn
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=6a914d3c.018c0331.f1305.be74@mx.google.com \
--to=manushprajwal555@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.