lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250201165753.53043-1-biju.das.jz@bp.renesas.com>
Date: Sat,  1 Feb 2025 16:57:51 +0000
From: Biju Das <biju.das.jz@...renesas.com>
To: Andrew Lunn <andrew+netdev@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>
Cc: Biju Das <biju.das.jz@...renesas.com>,
	Rosen Penev <rosenp@...il.com>,
	Shannon Nelson <shannon.nelson@....com>,
	Uwe Kleine-König <u.kleine-koenig@...libre.com>,
	Simon Horman <horms@...nel.org>,
	netdev@...r.kernel.org,
	Geert Uytterhoeven <geert+renesas@...der.be>,
	Biju Das <biju.das.au@...il.com>
Subject: [PATCH] net: ibm: emac: Use of_get_available_child_by_name()

Use the helper of_get_available_child_by_name() to simplify
emac_dt_mdio_probe().

Signed-off-by: Biju Das <biju.das.jz@...renesas.com>
---
This patch is only compile tested and depend upon[1]
[1] https://lore.kernel.org/all/20250201093126.7322-1-biju.das.jz@bp.renesas.com/
---
 drivers/net/ethernet/ibm/emac/core.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
index 25b8a3556004..079efc5ed9bc 100644
--- a/drivers/net/ethernet/ibm/emac/core.c
+++ b/drivers/net/ethernet/ibm/emac/core.c
@@ -2550,26 +2550,19 @@ static const struct mii_phy_ops emac_dt_mdio_phy_ops = {
 
 static int emac_dt_mdio_probe(struct emac_instance *dev)
 {
-	struct device_node *mii_np;
+	struct device_node *mii_np _free(device_node) =
+		of_get_available_child_by_name(dev->ofdev->dev.of_node, "mdio");
 	struct mii_bus *bus;
 	int res;
 
-	mii_np = of_get_child_by_name(dev->ofdev->dev.of_node, "mdio");
 	if (!mii_np) {
 		dev_err(&dev->ofdev->dev, "no mdio definition found.");
 		return -ENODEV;
 	}
 
-	if (!of_device_is_available(mii_np)) {
-		res = -ENODEV;
-		goto put_node;
-	}
-
 	bus = devm_mdiobus_alloc(&dev->ofdev->dev);
-	if (!bus) {
-		res = -ENOMEM;
-		goto put_node;
-	}
+	if (!bus)
+		return -ENOMEM;
 
 	bus->priv = dev->ndev;
 	bus->parent = dev->ndev->dev.parent;
@@ -2584,8 +2577,6 @@ static int emac_dt_mdio_probe(struct emac_instance *dev)
 			bus->name, res);
 	}
 
- put_node:
-	of_node_put(mii_np);
 	return res;
 }
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ