From: Javier Carrasco <javier.carrasco.cruz@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Yisen Zhuang <yisen.zhuang@huawei.com>,
Salil Mehta <salil.mehta@huawei.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Javier Carrasco <javier.carrasco.cruz@gmail.com>
Subject: [PATCH 0/2] net: switch to scoped device_for_each_child_node()
Date: Mon, 30 Sep 2024 22:03:28 +0200 [thread overview]
Message-ID: <20240930-net-device_for_each_child_node_scoped-v1-0-bbdd7f9fd649@gmail.com> (raw)
This series switches from the device_for_each_child_node() macro to its
scoped variant. This makes the code more robust if new early exits are
added to the loops, because there is no need for explicit calls to
fwnode_handle_put(), which also simplifies existing code.
The non-scoped macros to walk over nodes turn error-prone as soon as
the loop contains early exits (break, goto, return), and patches to
fix them show up regularly, sometimes due to new error paths in an
existing loop [1].
Note that the child node is now declared in the macro, and therefore the
explicit declaration is no longer required.
The general functionality should not be affected by this modification.
If functional changes are found, please report them back as errors.
Link:
https://lore.kernel.org/all/20240901160829.709296395@linuxfoundation.org/
[1]
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
Javier Carrasco (2):
net: mdio: switch to scoped device_for_each_child_node()
net: hns: switch to scoped device_for_each_child_node()
drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 10 +++-------
drivers/net/mdio/mdio-thunder.c | 4 +---
2 files changed, 4 insertions(+), 10 deletions(-)
---
base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc
change-id: 20240930-net-device_for_each_child_node_scoped-ebe62f742847
Best regards,
--
Javier Carrasco <javier.carrasco.cruz@gmail.com>
next reply other threads:[~2024-09-30 20:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-30 20:03 Javier Carrasco [this message]
2024-09-30 20:03 ` [PATCH 1/2] net: mdio: " Javier Carrasco
2024-09-30 20:10 ` Andrew Lunn
2024-09-30 20:24 ` Javier Carrasco
2024-09-30 20:03 ` [PATCH 2/2] net: hns: " Javier Carrasco
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=20240930-net-device_for_each_child_node_scoped-v1-0-bbdd7f9fd649@gmail.com \
--to=javier.carrasco.cruz@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=salil.mehta@huawei.com \
--cc=yisen.zhuang@huawei.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
all inboxes | Powered by JetHome®