net: dsa: microchip: cleanup error handling in ksz_mdio_register

Replace repeated cleanup code with a single error path using a label.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20241106075942.1636998-5-o.rempel@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Oleksij Rempel 2024-11-06 08:59:39 +01:00 committed by Jakub Kicinski
parent 9afaf0eec2
commit 8bbba4161b

View File

@ -2409,8 +2409,8 @@ static int ksz_mdio_register(struct ksz_device *dev)
bus = devm_mdiobus_alloc(ds->dev);
if (!bus) {
of_node_put(mdio_np);
return -ENOMEM;
ret = -ENOMEM;
goto put_mdio_node;
}
if (dev->dev_ops->mdio_bus_preinit) {
@ -2455,10 +2455,8 @@ static int ksz_mdio_register(struct ksz_device *dev)
if (dev->irq > 0) {
ret = ksz_irq_phy_setup(dev);
if (ret) {
of_node_put(mdio_np);
return ret;
}
if (ret)
goto put_mdio_node;
}
ret = devm_of_mdiobus_register(ds->dev, bus, mdio_np);