[PATCH 2/4] staging: octeon: fix OF node leak and kernel-doc in ethernet-mdio.c

From: Oscar Alejandro Sánchez Lucero via B4 Relay

Date: Sat Nov 07 2026 - 21:09:09 EST


From: Oscar Alejandro Sánchez Lucero <aleszlucero@xxxxxxxxx>

Fix a reference count leak in cvm_oct_phy_setup_device() where the
device_node pointer 'phy_node' was not released if of_phy_connect()
returned NULL on a probe deferral scenario. Balance the reference count
by calling of_node_put() within the error path block.

Additionally, correct the documentation style of the function by
replacing 'Returns' with the standard 'Return:' keyword to comply with
kernel-doc scripting requirements.

Signed-off-by: Oscar Alejandro Sánchez Lucero <aleszlucero@xxxxxxxxx>
---
drivers/staging/octeon/ethernet-mdio.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c
index 211423059e30..05bc536ebded 100644
--- a/drivers/staging/octeon/ethernet-mdio.c
+++ b/drivers/staging/octeon/ethernet-mdio.c
@@ -151,11 +151,13 @@ int cvm_oct_phy_setup_device(struct net_device *dev)

phydev = of_phy_connect(dev, phy_node, cvm_oct_adjust_link, 0,
priv->phy_mode);
- of_node_put(phy_node);

- if (!phydev)
+ if (!phydev) {
+ of_node_put(phy_node);
return -EPROBE_DEFER;
+ }

+ of_node_put(phy_node);
priv->last_link = 0;
phy_start(phydev);


--
2.56.0