Commit cf3c4663 authored by Pan Bian's avatar Pan Bian Committed by Jakub Kicinski

net: dsa: bcm_sf2: put device node before return

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

Fixes: 461cd1b0 ("net: dsa: bcm_sf2: Register our slave MDIO bus")
Signed-off-by: default avatarPan Bian <bianpan2016@163.com>
Link: https://lore.kernel.org/r/20210121123343.26330-1-bianpan2016@163.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 853c56b4
...@@ -509,15 +509,19 @@ static int bcm_sf2_mdio_register(struct dsa_switch *ds) ...@@ -509,15 +509,19 @@ static int bcm_sf2_mdio_register(struct dsa_switch *ds)
/* Find our integrated MDIO bus node */ /* Find our integrated MDIO bus node */
dn = of_find_compatible_node(NULL, NULL, "brcm,unimac-mdio"); dn = of_find_compatible_node(NULL, NULL, "brcm,unimac-mdio");
priv->master_mii_bus = of_mdio_find_bus(dn); 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; return -EPROBE_DEFER;
}
get_device(&priv->master_mii_bus->dev); get_device(&priv->master_mii_bus->dev);
priv->master_mii_dn = dn; priv->master_mii_dn = dn;
priv->slave_mii_bus = devm_mdiobus_alloc(ds->dev); 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; return -ENOMEM;
}
priv->slave_mii_bus->priv = priv; priv->slave_mii_bus->priv = priv;
priv->slave_mii_bus->name = "sf2 slave mii"; priv->slave_mii_bus->name = "sf2 slave mii";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment