[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240807190556.6817-1-rosenp@gmail.com>
Date: Wed, 7 Aug 2024 12:05:49 -0700
From: Rosen Penev <rosenp@...il.com>
To: netdev@...r.kernel.org
Subject: [PATCH] net: freescale: use devm for alloc_etherdev_mqs
Simpler and avoids having to call free_netdev.
Signed-off-by: Rosen Penev <rosenp@...il.com>
---
drivers/net/ethernet/freescale/fec_main.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index a923cb95cdc6..3e3704ab464a 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -4312,7 +4312,7 @@ fec_probe(struct platform_device *pdev)
fec_enet_get_queue_num(pdev, &num_tx_qs, &num_rx_qs);
/* Init network device */
- ndev = alloc_etherdev_mqs(sizeof(struct fec_enet_private) +
+ ndev = devm_alloc_etherdev_mqs(&pdev->dev, sizeof(struct fec_enet_private) +
FEC_STATS_SIZE, num_tx_qs, num_rx_qs);
if (!ndev)
return -ENOMEM;
@@ -4342,10 +4342,8 @@ fec_probe(struct platform_device *pdev)
pinctrl_pm_select_default_state(&pdev->dev);
fep->hwp = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(fep->hwp)) {
- ret = PTR_ERR(fep->hwp);
- goto failed_ioremap;
- }
+ if (IS_ERR(fep->hwp))
+ return PTR_ERR(fep->hwp);
fep->pdev = pdev;
fep->dev_id = dev_id++;
@@ -4603,7 +4601,6 @@ fec_drv_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
fec_enet_deinit(ndev);
- free_netdev(ndev);
}
static int __maybe_unused fec_suspend(struct device *dev)
--
2.45.2
Powered by blists - more mailing lists