Skip to contentSkip to conversation

net: dsa: bcm_sf2: put device node before return

PATCH Applied Pan Bian 2 participants 2 messages Jan 21, 2021 – Jan 23, 2021

Subsystems (4)
lore
Share & tools
lore

Pan Bian

author
#0 lore raw

PATCH 1/1 net: dsa: bcm_sf2: put device node before return

Put the device node dn before return error code on failure path.

Fixes 461cd1b03e32 ("net: dsa: bcm_sf2: Register our slave MDIO bus")
---
 drivers/net/dsa/bcm_sf2.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/dsa/bcm_sf2.c +6 -2
index 1e9a0adda2d6..445226720ff2 100644
@@ -509,15 +509,19 @@ static int bcm_sf2_mdio_register(struct dsa_switch *ds)
 	/* Find our integrated MDIO bus node */
 	dn = of_find_compatible_node(NULL, NULL, "brcm,unimac-mdio");
 	priv->master_mii_bus = of_mdio_find_bus(dn);
-	if (!priv->master_mii_bus)
+	if (!priv->master_mii_bus) {
+		of_node_put(dn);
 		return -EPROBE_DEFER;
+	}
 
 	get_device(&priv->master_mii_bus->dev);
 	priv->master_mii_dn = dn;
 
 	priv->slave_mii_bus = devm_mdiobus_alloc(ds->dev);
-	if (!priv->slave_mii_bus)
+	if (!priv->slave_mii_bus) {
+		of_node_put(dn);
 		return -ENOMEM;
+	}
 
 	priv->slave_mii_bus->priv = priv;
 	priv->slave_mii_bus->name = "sf2 slave mii";
Signature · 1 line
2.17.1
#1 lore raw
This patch was applied to netdev/net.git (refs/heads/master):

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

Quoted 7 lines · On Thu, 21 Jan 2021 04:33:43 -0800 you wrote:

Put the device node dn before return error code on failure path.

Fixes 461cd1b03e32 ("net: dsa: bcm_sf2: Register our slave MDIO bus")
---
 drivers/net/dsa/bcm_sf2.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Here is the summary with links:
- net: dsa: bcm_sf2: put device node before return

    https://git.kernel.org/netdev/net/c/cf3c46631e16

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html