[PATCH net-next 4/6] net: gianfar: use devm for register_netdev

Rosen Penev
2024-10-01T21:22:11Z

Avoids manual unregister netdev.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/net/ethernet/freescale/gianfar.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 66818d63cced..07936dccc389 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -3272,7 +3272,7 @@ static int gfar_probe(struct platform_device *ofdev)
/* Carrier starts down, phylib will bring it up */
netif_carrier_off(dev);

- err = register_netdev(dev);
+ err = devm_register_netdev(&ofdev->dev, dev);

if (err) {
pr_err("%s: Cannot register net device, aborting\n", dev->name);
@@ -3338,8 +3338,6 @@ static void gfar_remove(struct platform_device *ofdev)
of_node_put(priv->phy_node);
of_node_put(priv->tbi_node);

- unregister_netdev(priv->ndev);
-
if (of_phy_is_fixed_link(np))
of_phy_deregister_fixed_link(np);

--
2.46.2