[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240830031325.2406672-5-ruanjinjie@huawei.com>
Date: Fri, 30 Aug 2024 11:13:21 +0800
From: Jinjie Ruan <ruanjinjie@...wei.com>
To: <woojung.huh@...rochip.com>, <andrew@...n.ch>, <f.fainelli@...il.com>,
<olteanv@...il.com>, <davem@...emloft.net>, <edumazet@...gle.com>,
<kuba@...nel.org>, <pabeni@...hat.com>, <linus.walleij@...aro.org>,
<alsi@...g-olufsen.dk>, <justin.chen@...adcom.com>,
<sebastian.hesselbarth@...il.com>, <alexandre.torgue@...s.st.com>,
<joabreu@...opsys.com>, <mcoquelin.stm32@...il.com>, <wens@...e.org>,
<jernej.skrabec@...il.com>, <samuel@...lland.org>, <hkallweit1@...il.com>,
<linux@...linux.org.uk>, <UNGLinuxDriver@...rochip.com>,
<netdev@...r.kernel.org>, <bcm-kernel-feedback-list@...adcom.com>,
<linux-arm-kernel@...ts.infradead.org>, <linux-sunxi@...ts.linux.dev>,
<linux-stm32@...md-mailman.stormreply.com>, <krzk@...nel.org>,
<jic23@...nel.org>
CC: <ruanjinjie@...wei.com>
Subject: [PATCH net-next v4 4/8] net: mdio: mux-mmioreg: Simplified with scoped function
Avoids the need for manual cleanup of_node_put() in early exits
from the loop by using for_each_available_child_of_node_scoped().
Reviewed-by: Andrew Lunn <andrew@...n.ch>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Signed-off-by: Jinjie Ruan <ruanjinjie@...wei.com>
---
v4:
- Add Reviewed-by.
v3:
- Add Reviewed-by.
v2:
- Split into 2 patches.
---
drivers/net/mdio/mdio-mux-mmioreg.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/mdio/mdio-mux-mmioreg.c b/drivers/net/mdio/mdio-mux-mmioreg.c
index de08419d0c98..4d87e61fec7b 100644
--- a/drivers/net/mdio/mdio-mux-mmioreg.c
+++ b/drivers/net/mdio/mdio-mux-mmioreg.c
@@ -96,7 +96,7 @@ static int mdio_mux_mmioreg_switch_fn(int current_child, int desired_child,
static int mdio_mux_mmioreg_probe(struct platform_device *pdev)
{
- struct device_node *np2, *np = pdev->dev.of_node;
+ struct device_node *np = pdev->dev.of_node;
struct mdio_mux_mmioreg_state *s;
struct resource res;
const __be32 *iprop;
@@ -139,20 +139,18 @@ static int mdio_mux_mmioreg_probe(struct platform_device *pdev)
* Verify that the 'reg' property of each child MDIO bus does not
* set any bits outside of the 'mask'.
*/
- for_each_available_child_of_node(np, np2) {
+ for_each_available_child_of_node_scoped(np, np2) {
u64 reg;
if (of_property_read_reg(np2, 0, ®, NULL)) {
dev_err(&pdev->dev, "mdio-mux child node %pOF is "
"missing a 'reg' property\n", np2);
- of_node_put(np2);
return -ENODEV;
}
if ((u32)reg & ~s->mask) {
dev_err(&pdev->dev, "mdio-mux child node %pOF has "
"a 'reg' value with unmasked bits\n",
np2);
- of_node_put(np2);
return -ENODEV;
}
}
--
2.34.1
Powered by blists - more mailing lists